LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-08-2015, 04:37 PM   #1
regex
LQ Newbie
 
Registered: Dec 2015
Posts: 5

Rep: Reputation: Disabled
Is bash compatible with other shells?


hi,

If I wrote a bash script and change the #!/bin/bash to one of these

#!/bin/csh
#!/bin/tcsh
#!/bin/ksh
#!/bin/zsh
..
After installing that other shell will it work? eg. variables, for loops and etc.

Last edited by regex; 12-08-2015 at 04:43 PM.
 
Old 12-08-2015, 04:39 PM   #2
regex
LQ Newbie
 
Registered: Dec 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
deleted
 
Old 12-08-2015, 08:29 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,655

Rep: Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484
The basic concepts are the same, but the implementation differs, otherwise there would only be one shell..
 
Old 12-08-2015, 08:43 PM   #4
regex
LQ Newbie
 
Registered: Dec 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
I think I'll stick to bash since all my scripts use functions, variables, for loops that bash understands. Besides, bash is the universal language in many distros by default.

It took me a long time to grasp bash and to learn another shell with different variations is just to much.

appreciated chrism01

 
Old 12-09-2015, 02:02 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,655

Rep: Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484
Yeah, bash is the default shell in Linux for non-root anyway.
You may find some system scripts use sh (POSIX shell).

I'd also point out that ksh is very similar to bash and certainly used to be the most common default on (non-Linux) Unix systems.
NB: that's talking about the shell built-in cmds, not the external cmds you can call like eg awk, sed etc.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Bash Sub Shells LXer Syndicated Linux News 0 11-12-2008 12:00 PM
should you know other shells then bash? WOP1337 Linux - General 8 05-06-2007 08:30 PM
Compatible dvd writer and shells Nawas111 Linux - Hardware 1 11-25-2004 01:35 PM
Is this a bug? (BASH and Z shells) KingofBLASH Linux - Software 4 09-14-2004 06:14 PM
wait in bash shells raypen Linux - Software 1 04-18-2003 02:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration