Sponsored Content
Top Forums Shell Programming and Scripting I need to understand the differences between the bash shell and the Bourne shell Post 302368261 by awk_sed_hello on Wednesday 4th of November 2009 12:18:05 PM
Old 11-04-2009
I need to understand the differences between the bash shell and the Bourne shell

I do not claim to be an expert, but I have done things with scripts that whole teams of folks have said can not be done. Of course they should have said we do not have the intestinal fortitude to git-r-done.

I have been using UNIX actually HPUX since 1992. Unfortunately my old computer died and the proprietary software that I was using can not be used on Win 7. I downloaded cygdrive so that I could continue to run several awk and sed scripts I have written. These worked fine in my old Bourne shell (sh)

1st Question/comment. I have seen that #!/bin/bash must be the first line of a script. I see this as a comment not a command. Seems to me that there is confusion either on my part or the rest of the world.

The previous permissions on my script were lost probably due to windows.

I changed my script "trans_xy" to full permissions

"trans_xy"
Code:
#!/bin/bash # I think this command is BS > debug effort
# Process XY data
echo Process XY data
#cp 60-121130-01r2_ipc.net ipc # debug attempt ipc exist
sed s/" -"/" DOT."/ ipc > raw
awk '$2~/MTG/{print $0}' ipc > mtg
awk '$2~/TP/{print $0}' ipc > tp
awk '$3~/DOT/{print $0}' raw > raw1
awk '$2~/VIA/{print $0}' raw1 > vias
awk '$2!~/VIA/{print $0}' raw1 > raw_xy
sed s/"R180"/" R180"/g raw_xy > raw_xy_1
sed s/"R270"/" R270"/g raw_xy_1 > raw_xy_2

chmod 777 trans_xy
ls -l
trans_xy -rwxrwxrwx

the result copied from the bash window intresting font from the stdout

Code:
$ ./trans_xy
Process XY data
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory_1
: No such file or directory_2

If I paste the commands into bash they work like a champ.
I suspect that bash does not know to do it's work in the pwd it seems odd that the output file is referenced in the crude error message displayed on the stdout.

Notice that the error message is screwed up

command from script
sed s/"R180"/" R180"/g raw_xy > raw_xy_1
result
: No such file or directory_1

command from script
sed s/"R270"/" R270"/g raw_xy_1 > raw_xy_2
result
: No such file or directory_2

Does anyone know if what the heck is happening here?

Last edited by pludi; 11-04-2009 at 01:35 PM.. Reason: cleanup
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Bourne-again shell

Hi guys !! well i'm still new in learning UNIX , and actually i'm still studying it by myself .. anyway, some people told me the Bourne-again shell is a good version of UNIX to work on , and i tried to download yesterday but i didn't know how to start it ...... the ReadMe file associated with... (3 Replies)
Discussion started by: mrsamer
3 Replies

2. UNIX for Dummies Questions & Answers

bourne shell or korn shell?

Hi, I have a script that uses "nohup" command to execute a korn shell script. Which one is the correct shell to use bourne shell or korn shell to execute a korn shell? and why? Thanks in advanced. (2 Replies)
Discussion started by: XZOR
2 Replies

3. Shell Programming and Scripting

C shell & Bourne Shell

Hi Guys, My first post and simple one at that .. Really rusty with this shell scripting..\ I have a script called .. j.sh I am calling > j.sh LOG_PATH $BLMBRGDATA/blmbrg.properties where j.sh is grep $1 $2 | cut -d',' -f2 . $BLMBRGDATA is set to a directory path. why do i get :- $... (3 Replies)
Discussion started by: jsm66
3 Replies

4. Shell Programming and Scripting

bash shell: 'exec', 'eval', 'source' - looking for help to understand

Hi, experts. Whould anybody clear explay me difference and usage of these 3 commands (particulary in bash) : exec eval source I've tryed to read the manual pages but did not get much. Also could not get something useful from Google search - just so much and so not exactly, that is... (3 Replies)
Discussion started by: alex_5161
3 Replies

5. Shell Programming and Scripting

How to activate Korn Shell functionnalities in Bourne Shell

Hi All I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell. Some operations like calculation don't work : cat ${file1} | tail -$((${num1}-${num2})) > ${file2} Is it possible to activate Korn Shell... (3 Replies)
Discussion started by: madmat
3 Replies

6. Shell Programming and Scripting

Bourne/C shell help

Exercise Five Write a Bourne shell script which: • Professionalism: plan for this from the start. • Has one command line argument. • If the command line argument is a directory then the script should output the number of files in the directory. • If the command line argument is an ordinary... (2 Replies)
Discussion started by: moesom
2 Replies

7. Shell Programming and Scripting

Bourne shell & Korn shell

Could some one tell me the difference btw Bourne shell and the Kshell? Which is more flexible and reliable in terms of portability and efficiency. When i type the following command .. $ echo $SHELL yields me /bin/sh Does this tells me that I am in Bourne shell. If yes, how can i get... (6 Replies)
Discussion started by: bobby1015
6 Replies

8. Shell Programming and Scripting

Confusion about FOR LOOP syntax between Bourne and BASH shell. Please see.

for (( i=1; i<=3; i++ )); do for (( j=1; j<=3; j++ )); do for (( k=1; k<=3; k++ )); do echo $i$j$k done done done Will the above code work on a BOURNE shell? As far as my understanding is, if I am writing the above code in a file..say lol.sh and then running it through the terminal using... (7 Replies)
Discussion started by: navienavnav
7 Replies

9. Cybersecurity

'Shell Shock' vulnerability in Bourne shell

A severe vulnerability was discovered in Bourne shell. Just google for: bash vulnerability ... for more details. (5 Replies)
Discussion started by: Cochise
5 Replies

10. Shell Programming and Scripting

How to understand special character for line reading in bash shell?

I am still learning shell scripting. Recently I see a function for read configuration. But some of special character make me confused. I checked online to find answer. It was not successful. I post the code here to consult with expert or guru to get better understanding on these special characters... (3 Replies)
Discussion started by: duke0001
3 Replies
All times are GMT -4. The time now is 06:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy