Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Code for automatic change of unix shells to bash

Status
Not open for further replies.

ravet

Member level 5
Joined
Sep 17, 2006
Messages
81
Helped
4
Reputation
8
Reaction score
2
Trophy points
1,288
Location
DSO
Activity points
1,762
Hello

i want to write a shell script that can be able to change the shell, i.e. i wrote a code that can run correctly in bash and not in csh, so, i want to add something in the code so that it automatic can change the shell to bash, whatever the current shell is, and after finishing , it automatically reload the previous shell....

thanks
 

Re: unix shells

Hi,

use "magic number" #! at the first line of the script, for example

#!/bin/bash

this specify, which shell will be used to execute the script, see:

h**p://www.faqs.org/faqs/unix-faq/faq/part3/section-16.html

blue_snake
 

Re: unix shells

Hi
You can specify the interpreter (and options) for the script at the beginning of the script as "#<path to the interpreter>".
Eg: #!/bin/bash
#!/bin/sh
#!/usr/bin/perl
 

unix shells

When your shell script exits, no matter which language or interpreter you use, the previous environment is restored. Which means you're are already automatically back to your original shell.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top