Trouble understanding shell scripting (mostly wsname)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trouble understanding shell scripting (mostly wsname)
# 1  
Old 10-01-2014
Trouble understanding shell scripting (mostly wsname)

Am still learning Scripting and I come across a build command that I don't really understand

Code:
if /local/bin/wsname 2>/dev/null; then
    base="`/local/bin/wsname`"
    export base
fi

Code:
if [ -z "${base}" ]; then
    /local/bin/wsname 
    exit 1
fi

Code:
WSNAME="$base"/

can some one in light me to what it should be doing???

Thanks
# 2  
Old 10-01-2014
Facebook

Quote:
Originally Posted by Wpgn
. . .
Code:
if /local/bin/wsname 2>/dev/null; then         # run wsname discarding its err msgs and check the exit code; if 0 then
    base="`/local/bin/wsname`"                 # assign the output of wsname to the variable "base"
    export base                                # and export that
fi

Code:
if [ -z "${base}" ]; then                      # if base is not set
    /local/bin/wsname                          # run wsname again 
    exit 1                                     # and exit with error code
fi

Code:
WSNAME="$base"/                                # assign base's content, extended by a "/" (making up a directory entry?), to the WSNAME variable

Quote:
can some one in light me to what it should be doing???

Thanks
For more enlightenment we need to see more context...
This User Gave Thanks to RudiC For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. What is on Your Mind?

I'm having trouble understanding what it is I need to do

Ok, thank you. Again I'm new to the programming thing, I'm just trying to figure out what exactly it is I need to do. How would I cash out bits? Numerous questions. I'm a dreamer. AI attempts to communicate with me regularly especially through unfinished apps that I'm assuming is my responsibility... (1 Reply)
Discussion started by: C-lo
1 Replies

2. UNIX for Dummies Questions & Answers

[Solved] Need help understanding ksh scripting.

Can any one please tell me where the error in below script. Output is not as per my requirement. if condition not comparing the result of record count of a file with 1. where is the pbm in my script? Appreciate your help.. #!/bin/ksh #Module- #Summary- To move the file to direcotries if... (9 Replies)
Discussion started by: shivadanam
9 Replies

3. Shell Programming and Scripting

Trouble with variable assignment and reading in shell scripting

Hi, I have an inputfile with some table names in it. For ex: t_arnge t_profl t_fac I need a script which reads the line one by one and need to assign to some dynamic variable. If to explain the above example: i need some a=table_name1 table_name1=t_arnge in first time and... (4 Replies)
Discussion started by: Ravindra Swan
4 Replies

4. Shell Programming and Scripting

Understanding Shell Scripting

Hi Gurus, Im new to Shell scripting. I have a shell script which basically sends an email when called thorugh my ETL tool. Wanted to understand the its functionality in detail. Would be great it any one can explain what exactly the commands to #!/bin/sh # Dummy UUCP rmail command for... (1 Reply)
Discussion started by: r_t_1601
1 Replies

5. Homework & Coursework Questions

trouble understanding file option and command line arguments

Hi, I am creating a program with the C language that simulates the WC command in Unix. My program needs to count lines, bytes and words. I have not added the code to count bytes and words yet. I am having trouble understanding what the file option/flag '-' does. I can not visualize how it moves... (1 Reply)
Discussion started by: heywoodfloyd
1 Replies

6. UNIX for Dummies Questions & Answers

Having trouble understanding this command: >foo<bar bc

Sometimes it works for me and sometimes I get this error: syntax error on line 1, teletype Basically I've got no idea whats going on, especially at the end of the command: bc Any help is appreciated (1 Reply)
Discussion started by: phunkypants
1 Replies

7. Shell Programming and Scripting

Understanding of a script as a scripting newbie

Hi! I have the following script and do not understand part of it. I have a very little understanding of scripting. The script is for Nagios to check the response of fast-com.de. The guy who has written it is no longer in the company. #!/bin/sh PATH=/adm/bin:/bin:/usr/bin export PATH ... (2 Replies)
Discussion started by: locutus01
2 Replies

8. UNIX for Dummies Questions & Answers

Little Trouble Understanding some code...

Couple of questions as I try to decipher someones code who left... What would something coded like this do? IFS=: grep FIELD1 /Path/Path2/Param.fle | read LBL1 LBL2 USRID EADR SUBJ SERVERNAME CFGTBL DIR ERR=0 Param.fle contents.. FIELD1:FEI::FIELD2:dATAFIELD BATCH:MAIN SERVER......etc.. (2 Replies)
Discussion started by: NycUnxer
2 Replies

9. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies
Login or Register to Ask a Question