Meaning of code


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Meaning of code
# 1  
Old 06-27-2007
Error Meaning of code

Hi

Can anybody tell me what is the meaning of the following code?

i=4 j=1 k=0
[ $i -o $j -o $k ]Specialy meaning of this line
echo $?
[ $i -a $j -a $k ]Specialy meaning of this line
echo $?
[ $i -a $j -o $k ]Specialy meaning of this line
echo $?

Thanks in advance

Sas
# 2  
Old 06-27-2007
First thing, please read the shell man pages.

i=4 j=1 k=0 Assign values 4, 1 and 0 to variables i, j, k
[ $i -o $j -o $k ] Test if one of the variable i j k is not emtty. Status $? is set to 1 if all variables are empty, and set to 0otherwise
echo $? Display exit status of the last command
[ $i -a $j -a $k ] Test that the variables i j k aren't empty. Status $? is set to 0 if all variables are empty, and set to 1 otherwise
# 3  
Old 06-27-2007
That means if i write [ $x ], it checks whether the var x is null or not?Am i right???
# 4  
Old 06-27-2007
Quote:
Originally Posted by SasDutta
That means if i write [ $x ], it checks whether the var x is null or not?Am i right???
You are right
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Meaning of $1^

Hello everyone, I'm looking for the meaning of this expression, as I don't understand it quite clearly : $1^ What do you think it could be? I thought either: - match lines starting with argument 1 but it should be ^$1 - turn line around : word becomes drow Thanks in advance for your... (4 Replies)
Discussion started by: bibelo
4 Replies

2. Shell Programming and Scripting

What is the meaning of the following Perl Code?

Hi All Can any one please help me to understand the below Perl Code package Win32::File; # # File.pm # Written by Douglas_Lankshear@ActiveWare.com # # subsequent hacks: # Gurusamy Sarathy # $VERSION = '0.06'; require Exporter; require DynaLoader; @ISA= qw( Exporter... (1 Reply)
Discussion started by: adisky123
1 Replies

3. UNIX for Dummies Questions & Answers

meaning of <<!

Hi all, I wanna know the meaning of the last word "<<! " sudo su - user <<! please help on this !!!! (1 Reply)
Discussion started by: sudharson
1 Replies

4. Shell Programming and Scripting

^$$ meaning

Hi , Can anyone please let me know whta the follwoing piece of code for ScriptName=${0##*/} if pgrep -f "$ScriptName" | grep -v "^$$\$" ; then echo `date`": Sctipt $ScritName is already runnig" exit fi Thnx a lot in advance Please use code tags when posting data and code... (8 Replies)
Discussion started by: Pratik4891
8 Replies

5. Shell Programming and Scripting

meaning of !*

can someone please tell what !* means in shell syntax. Regards, (3 Replies)
Discussion started by: busyboy
3 Replies

6. Shell Programming and Scripting

What is the meaning of $_

Hi, Can somebody tell the usage of "$_" cd $_ ? and ls $_ ? (4 Replies)
Discussion started by: giri_luck
4 Replies

7. UNIX for Dummies Questions & Answers

what the meaning of #*

can some one please tell the meaning of the second statement i.e n=${m#*=} i couldnt get the meaning of the #*= 1.) m="mohit=/c/main/issue" echo $m result ----------- mohit=/c/main/issue 2.) n=${m#*=} echo $n RESULT ------- /c/main/issue (1 Reply)
Discussion started by: narang.mohit
1 Replies

8. Shell Programming and Scripting

can any one explain the meaning of the below code ?

while getopts :g:l:h: KEY $* do case $KEY in g) NAME=$OPTARG ;; l) LAB=$OPTARG ;; h) HD=$OPTARG ;; *) echo "Illegal option: $OPTARG" echo "$usage" exitStatus=1 exitGrace esac done (2 Replies)
Discussion started by: santosh1234
2 Replies

9. AIX

meaning of ${0%${0##*/}}

. ${0%${0##*/}}Script_Name if i issue this command, it is executing the script. can any one tell what is the meaning of ${0%${0##*/}} (7 Replies)
Discussion started by: nyelavarthy
7 Replies

10. Shell Programming and Scripting

Whats the meaning of this code

Hi all, I am unable interpret this code ......... nohup $OPSSHLPATH/mkt_sas_load_cic.sh $db_name $process_id $loc_mm > $OPSLSTPATH/mkt_sas_load_cic.out & Thanks ....In advance (7 Replies)
Discussion started by: dhananjaysk
7 Replies
Login or Register to Ask a Question