Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

asked on

understanding .ksh

hi guys

we have inherited some .ksh files which we are trying to understand.

I have some questions in the below .ksh file


if [ "$#" -lt 1 ]; then   --does this mean paramatres less than 1 ?
        echo "Usage: $0 $1 <config file>"
        exit 1
fi

SCRIPT_PATH="${BASH_SOURCE[0]}";   --what is BASH_SOURCE[0]  mean here?
if([ -h "${SCRIPT_PATH}" ]) then   --what does this mean?
  while([ -h "${SCRIPT_PATH}" ]) do SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done   --what does this mean?
fi

Open in new window


thanks
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

if [ "$#" -lt 1 ]; then

>> --does this mean paramatres less than 1 ? <<

Yes, $# contains the number of command line parameters.

 [  ] indicates a test, and -lt means "less than"

Please note that "--" does not start a comment! ksh comments start with "#"
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Roy

ASKER

thanks
Avatar of Jay Roy

ASKER

>>[ -h "${SCRIPT_PATH}" ] tests whether the name found with  ${BASH_SOURCE[0]} exists and is a symbolic link..

can you please tell me what is a symbolic link ?
A symbolic link is an entry in a filesystem (a special type of file) which contains a reference to another directory or file.

A symbolic link is "transparent" to most applications, which means that you can work with the link as you could with the original file. The filesystem will forward requests against the link to the original file or directory.
Avatar of Jay Roy

ASKER

thanks