Bash Shell to sh Shell In a Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash Shell to sh Shell In a Script
# 1  
Old 08-28-2008
Question Bash Shell to sh Shell In a Script

Hi All,
I am in Bash Shell and Running A script that contains Exit statement in that in last ( to return to sh shell after executing) But it is not coming to sh shell after the script is excuted.
How to return to sh shell from bash shell through a script.
# 2  
Old 08-28-2008
If it doesn't return, what happens then? It just hangs up opr what? May be in the last lines of script some lengthy command is executing?
# 3  
Old 08-28-2008
Post your script within code tags (select the code and click on the '#' above the edit window), and we'll see how we can assist.

Regards
# 4  
Old 08-28-2008
Quote:
Originally Posted by saurabh84g
Hi All,
I am in Bash Shell and Running A script that contains Exit statement in that in last ( to return to sh shell after executing) But it is not coming to sh shell after the script is excuted.
How to return to sh shell from bash shell through a script.
Please post your code or use "sh -x scriptname " to see its execution to find out where it gets hang
# 5  
Old 08-28-2008
Question Reply to Above Thread

Actually i m just redirecting the output of single command to a file name ( for the Database)

through a script

ping localhost > abc.sh$"$(date ' +%d%b%y')".lst
exit

Case1)
Bash-3.2#./abc.sh
Bash-3.2#

output)abc28Aug.lst == correct output===

Case2) #./abc.sh

output) abc$$(date '+%d%b%y').lst ===wrong output=====

After executing in a bash shell it should not come to bash shell ,
i want to run the script from the sh shell only ?
# 6  
Old 08-28-2008
Probably you end up running a different version of ping which just keeps on looping forever. Perhaps your PATH is different in Bash than in the regular Bourne shell. Try specifying an explicit pathname like /bin/ping or whatever works for you.

Some versions of ping accept an argument -c 1 which says to send only one packet and then quit (or any number after -c of course); if not specified, they will loop forever.

If your shell doesn't understand $(...) you can use `...` instead (those are grave accents -- ASCII 96 -- not regular straight apostrophes).
# 7  
Old 08-29-2008
HOW to Return to sh Shell From bash shell

Quote:
Originally Posted by era
Probably you end up running a different version of ping which just keeps on looping forever. Perhaps your PATH is different in Bash than in the regular Bourne shell. Try specifying an explicit pathname like /bin/ping or whatever works for you.

Some versions of ping accept an argument -c 1 which says to send only one packet and then quit (or any number after -c of course); if not specified, they will loop forever.

If your shell doesn't understand $(...) you can use `...` instead (those are grave accents -- ASCII 96 -- not regular straight apostrophes).

Their is nOthing wrong with the Ping
the question is how to come to sh shell by running a script from bash shell .Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ? --- Post updated at 08:39 AM --- in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies

2. Shell Programming and Scripting

Different behavior between bash shell and bash script for cmd

So I'm trying to pass certain json elements as env vars and use them later on in a script. Sample json: JSON='{ "Element1": "file-123456", "Element2": "Name, of, company written in, a very weird way", "Element3": "path/to/some/file.txt", }' (part of the) script: for s... (5 Replies)
Discussion started by: da1
5 Replies

3. Shell Programming and Scripting

Bash Shell Script

HELP!My program ends after entering one choice---need help making it take multiple inputs,instead of terminating after displaying just one #!/bin/bash# Crude address databaseclear # Clear the screen.echo " Contact List"echo " ------- ----"echo "Choose one of the following... (6 Replies)
Discussion started by: help123
6 Replies

4. Shell Programming and Scripting

Bash shell script- help

I need to invoke a program on remote server using ssh in a shell script. In addition i would like to capture date/time and if there is any errors , then script should write to log file. can someone please help me out? (1 Reply)
Discussion started by: sam101
1 Replies

5. Shell Programming and Scripting

Help with Bash Shell Script

I am fairly new to Unix scripting. A need has come where I need to to read the first column of a tab delimited file. The first column will be an id number and so I would need to read the first column one by one and create another file with only unique id numbers. So for example, if I have the... (14 Replies)
Discussion started by: khanvader
14 Replies

6. Shell Programming and Scripting

bash shell script

i want to monitor which users logged in to unix system if users who logged in more than once then store to a text file . any idea? (2 Replies)
Discussion started by: CheeSen
2 Replies

7. UNIX for Dummies Questions & Answers

Bash shell script

Hi Guys, I am trying to alter a script for my company. I need the start of it to go something like this. User is asked to input 8 numbers 8 numbers are written to a txt file ***** ***** ***** txt file is read ***** ***** The text file gets read in between other files represented by... (2 Replies)
Discussion started by: outthere_3
2 Replies

8. Shell Programming and Scripting

BASH Shell Script Help -HELP!

Im a newbie to shell scripting - in fact you could even call me a Linux newbie, well, mabye not i started with CYGWIN a year ago... but i only just recently wiped the Windoze partition off my drive. -Anyways, heres the script i have a problem with: #!/bin/bash # #PeMPcoder function... (2 Replies)
Discussion started by: flamethrower0
2 Replies

9. Shell Programming and Scripting

bash shell script

im trying to teach my self bash shell scripting. i want to include command line arguments in my script i am writing for practice. when i run my script it dosnt make a difference what arguments there are, it just out puts the error message as if there were none. here is the check_opts () function in... (4 Replies)
Discussion started by: norsk hedensk
4 Replies
Login or Register to Ask a Question