Tag: shell script

KSH Script Basics | Special Shell Variables

Check out this article about KSH Script Basics | Special Shell Variables. Please tell me what you think about it. You can contact me anytime!

Just deleted tons of stale, unsused user accounts. Here are some KSH shell basics and special shell variable. I need to Google them up myself to get reminded that ‘$?’ is the output variable for script execution. That is, it’s 0 for successful execution and 1 if there is any error.

Continue reading »

Looping Through a List of Arguments (bourne)

Check out this article about Looping Through a List of Arguments (bourne). Please tell me what you think about it. You can contact me anytime!

The Bourne shell for loop looks like this:

    for arg in list
do
...Handle $arg...
done

Real life application.. :)

# ls -l | awk ‘{print$9}’

user01
user02
user03
user04
user05
user06
user07
user08
user09
# pwd
/home
# for x in `ls -l | awk ‘{print$9}’`
> do
> chown $x $x
> done
# ls -aslt
total 136

.. yeah you know what the output is.. :)