shell script doubt


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell script doubt
# 1  
Old 12-05-2007
shell script doubt

Hi,
While reading a shell script ,i have come accross the following statements.

script_name_full=$0
***script_name=${script_name_full##*\}
***script_name_noexst=${script_name%%\.ksh}
host_name=`hostname`
***host_name_short=${host_name%%\.*}
can anybody tell me what is the purpose of marked statements(2,3,5).
cheers
RRK
# 2  
Old 12-05-2007
hi

the line in your script are commented, so no use of that lines in your script
# 3  
Old 12-05-2007
Look under Parameter Expansion in man bash.
# 4  
Old 12-05-2007
Quote:
Originally Posted by LAKSHMI NARAYAN
the line in your script are commented, so no use of that lines in your script
A "*" is a comment in a shell script?
# 5  
Old 12-05-2007
No,The are not comments .I put them foe identification.
Here is the actual script.

script_name_full=$0
script_name=${script_name_full##*\}
script_name_noexst=${script_name%%\.ksh}
host_name=`hostname`
host_name_short=${host_name%%\.*}

cheers
RRK
# 6  
Old 12-05-2007
Quote:
Originally Posted by ravi raj kumar
No,The are not comments .I put them foe identification.
Here is the actual script.

script_name_full=$0
script_name=${script_name_full##*\}
script_name_noexst=${script_name%%\.ksh}
host_name=`hostname`
host_name_short=${host_name%%\.*}

cheers
RRK
So have you looked up Parameter Expansion in man bash ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Oracle function invoked from shell script doubt

hi gurus, I have tried myself to invoke an oracle function. there are three different function available need to be called for differnt. can you tell me whether the below code is correct to call oracle function from shell script. Any help would be highly appreciated. cat location.sh ... (5 Replies)
Discussion started by: arun888
5 Replies

2. Shell Programming and Scripting

Shell scripting Variable doubt

Dear Friends, If i give the command echo $- i am getting output of himBH. Can some body explain what does it means echo $- himBH Thanks in Advance Rajkumar (2 Replies)
Discussion started by: rajkumarin
2 Replies

3. Shell Programming and Scripting

Bash shell scripting doubt

Hello All, I am setting up a cron job, where i am calling a shell script to make few builds. I got struck at a point, need some expert inputs to proceed further. The script is categorized in 5 parts and in the last part while building software it asks for few questions like:- 1. Build mode... (4 Replies)
Discussion started by: sahil_jammu
4 Replies

4. Shell Programming and Scripting

Shell redirection doubt

Hi, Could anyone explain me why I am getting the 'broken pipe' error for the below? exec 3>&1 echo cat | cat <&3 -su: echo: write error: Broken pipe (2 Replies)
Discussion started by: royalibrahim
2 Replies

5. Shell Programming and Scripting

plz help normal doubt abt shell script

How to print a only files and not directories in a path. for exam :a user consists both files and directoris in his path. i have to write a script to display only files not dirctories. and only dirctories not files. Advance thanks to forum members.:) (5 Replies)
Discussion started by: sivaranga001
5 Replies

6. Shell Programming and Scripting

shell script basic doubt

hi, I am new script learner, so my basic doubt is , how to store value of any command in a variable example $ ls | wc -l i want to stote the output of this in a variable c. so that i can use c in if else loop. and when do we use " ` " symbol in script.. can anyone also tell for... (5 Replies)
Discussion started by: hi2_t
5 Replies

7. Shell Programming and Scripting

Doubt in running shell script

Hi, I'm a newbie in shell script. I have a problem in running my a.out in a bash shell script named vetri . The following is the code. #!bash/bin ./a.out abc.xyz where ./a.out is a c++ bin file and abc.xyz is an argument. My ./a.out expects an input (cin >> temp). How can I give the... (5 Replies)
Discussion started by: lchokka
5 Replies

8. Shell Programming and Scripting

Shell scripting basic doubt

Hi, I have a script called sam.sh which consists of a single echo statement like this #/usr/bin/ksh echo "Mani" I changed the mode for the script by giving chmod a+x sam.sh. If I want to execute the scrpt by just giving the name at the command line "sam.sh", what should I necessarily do?... (3 Replies)
Discussion started by: sendhilmani123
3 Replies

9. UNIX for Advanced & Expert Users

shell / awk doubt

Hi all, I have a ascii text file like this : $cat a.txt abc |12343 |xyakdfj | x |323 || kr1 |13434343|234343 | Is it possible to to get the file eleminating blank spaces? output file : abc|12343|xyakdfj| x|323||... (7 Replies)
Discussion started by: krishna
7 Replies

10. UNIX for Dummies Questions & Answers

Unix + oracle doubt....involving shell script

....does the dbms_output.put_line work inside unix shell script? i mean this is to be inside the sqlplus connection as follows!! sqlplus -s $UP <<EOJ .. .. .. dbms_output.put_line ('Insertion procedure failed for UPC BC : ' || wk_key_value || ' Sqlcode: ' || SQLCODE || ' Error... (2 Replies)
Discussion started by: mexx_freedom
2 Replies
Login or Register to Ask a Question