Web hosting isp - getUID() { id $1 | sed -e ’s/(.*$//’
getUID() { id $1 | sed -e ’s/(.*$//’ -e ’s/^uid=//’ } This function executes the id command and then uses a sed filter to delete all the unimportant information. When the function is called by itself getUID the output looks like the following: 500 When the function is called with a username getUID vathsa the output looks like the following: 500 Usually you need to compare this output to some known UID as follows: if [ ” getUID ” -gt 100 ] ; then printERROR “You do not have sufficient privileges.” exit 1 fi Here the output of the getUID function is checked to see whether it is greater than 100. The Complete Library Listing 21.1 contains a complete listing of the shell library, libTYSP.sh, discussed in this chapter. The line numbers are present for your reference and should not be entered into a script library file that you plan to use. Listing 21.1–Complete Listing of the Shell Library libTYSP.sh 1 #!/bin/sh 2 3 ################################################ 4 # Name: printERROR 5 # Desc: prints an message to STDERR 6 # Args: $@ -> message to print 7 ################################################ 8
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.