Posts: 69
Threads: 18
Joined: Aug 2018
Reputation:
0
As the title suggests, I was wondering what is the difference between BASH scripting language & SHELL language?
Do they have some different syntax / commands?
Is it just more portable to use SHELL and if that's all, why does BASH exist if you have SHELL etc?
What are the different limitations? e,g, does SHELL do more or apply to more?
Which is better to learn? Thanks, any information that helps is appreciated
Posts: 342
Threads: 7
Joined: Aug 2018
Reputation:
58
BASH can be thought as Shell v2.
They both share a lot of similarities and many sh scripts will execute under BASH as long as the path is changed.
BASH just wasn't as portable in the past. For example SH runs on Linux, BSD, Solaris, HP-UX, etc. That was not true of BASH, at least out of the box.
On Solaris one had to install BASH in the early days. Solaris did start including BASH, still it wasn't recommended on that OS.
If you are going to be working with modern Linux desktops then I would suggest sticking with BASH. Some IoT stuff doesn't like BASH as it can be stripped out.
Now there are other shells but if you want max portability stick with BASH. Of course the choice is yours.
Jeremy (Mr. Server)
* Desktop: Ubuntu MATE
* Windows are for your walls, Apple is for your health, Linux is for your computer
Posts: 55
Threads: 2
Joined: Aug 2018
Reputation:
4
09-10-2018, 07:44 PM
(This post was last modified: 09-11-2018, 08:09 PM by Mauser.)
No difference. Both are Gibberish.
Switched from Windows to Linux on 9/2015. I use MX-17.1 Linux.
Posts: 69
Threads: 18
Joined: Aug 2018
Reputation:
0
09-11-2018, 11:01 AM
(This post was last modified: 09-11-2018, 11:03 AM by dai-3.)
(09-10-2018, 07:06 PM)cleverwise Wrote: BASH can be thought as Shell v2.
They both share a lot of similarities and many sh scripts will execute under BASH as long as the path is changed.
BASH just wasn't as portable in the past. For example SH runs on Linux, BSD, Solaris, HP-UX, etc. That was not true of BASH, at least out of the box.
On Solaris one had to install BASH in the early days. Solaris did start including BASH, still it wasn't recommended on that OS.
If you are going to be working with modern Linux desktops then I would suggest sticking with BASH. Some IoT stuff doesn't like BASH as it can be stripped out.
Now there are other shells but if you want max portability stick with BASH. Of course the choice is yours. 
Is there a reason why this does not execute because of the shell/bash/
#!/bin/bash
echo "What distro do you like?"
select distro in\
debian\
mint\
slitaz\
do
echo "You picked $distro" # = unexpected syntax error , echo...?
done
select is blue , distro & in are white? in should be different?
do is white, echo & done are blue? do & done should match?
What am I missing, if you can help?
Probably something obviously simple
tutorial is tried in .rc & .sh
Posts: 29
Threads: 0
Joined: Sep 2018
Reputation:
12
09-11-2018, 11:50 AM
(This post was last modified: 09-11-2018, 12:21 PM by radolkin.)
(09-11-2018, 11:01 AM)ai-3 Wrote: (09-10-2018, 07:06 PM)cleverwise Wrote: BASH can be thought as Shell v2.
They both share a lot of similarities and many sh scripts will execute under BASH as long as the path is changed.
BASH just wasn't as portable in the past. For example SH runs on Linux, BSD, Solaris, HP-UX, etc. That was not true of BASH, at least out of the box.
On Solaris one had to install BASH in the early days. Solaris did start including BASH, still it wasn't recommended on that OS.
If you are going to be working with modern Linux desktops then I would suggest sticking with BASH. Some IoT stuff doesn't like BASH as it can be stripped out.
Now there are other shells but if you want max portability stick with BASH. Of course the choice is yours. 
Is there a reason why this does not execute because of the shell/bash/
#!/bin/bash
echo "What distro do you like?"
select distro in\
debian\
mint\
slitaz\
do
echo "You picked $distro" # = unexpected syntax error , echo...?
done
select is blue , distro & in are white? in should be different?
do is white, echo & done are blue? do & done should match?
What am I missing, if you can help?
Probably something obviously simple 
tutorial is tried in .rc & .sh
You forgot the semicolon after your list of choices, meaning behind 'slitaz'. Unlike the for loop, select requires this, even if you put the do in a new line. Stupid, I know.
Furthermore, you don't present any way to get out of the select loop, but <Ctrl+C> is everyone's friend here.
EDIT:
Forget, what I just said. I'm the stupid one here, not the select loop.
The problem isn't a missing semicolon, but your '\' after 'slitaz'. This pulls the following do into the same line, and then you need the semicolon. If you omit the last backslash, then everything is fine.
I'm getting too old for this. ;-)
Posts: 342
Threads: 7
Joined: Aug 2018
Reputation:
58
09-11-2018, 12:25 PM
(This post was last modified: 09-11-2018, 12:26 PM by cleverwise.)
(09-11-2018, 11:01 AM)dai-3 Wrote: Is there a reason why this does not execute because of the shell/bash/
#!/bin/bash
echo "What distro do you like?"
select distro in\
debian\
mint\
slitaz\
do
echo "You picked $distro" # = unexpected syntax error , echo...?
done
select is blue , distro & in are white? in should be different?
do is white, echo & done are blue? do & done should match?
What am I missing, if you can help?
Probably something obviously simple 
tutorial is tried in .rc & .sh
It isn't really the best idea to put the choices on multiple lines. This fixes the issue:
From:
Code: select distro in\
debian\
mint\
slitaz\
To:
Code: select distro in debian mint slitaz
That one change allows the script to work. However you are still stuck in the script. So you should add break (given this code at least).
Code: #!/bin/bash
echo "What distro do you like?"
select distro in debian mint slitaz
do
echo "You picked $distro" # = unexpected syntax error , echo...?
break
done
That will run without errors. Also I would put the choices into an array myself.
Jeremy (Mr. Server)
* Desktop: Ubuntu MATE
* Windows are for your walls, Apple is for your health, Linux is for your computer
Posts: 69
Threads: 18
Joined: Aug 2018
Reputation:
0
(09-11-2018, 12:25 PM)cleverwise Wrote: (09-11-2018, 11:01 AM)dai-3 Wrote: Is there a reason why this does not execute because of the shell/bash/
#!/bin/bash
echo "What distro do you like?"
select distro in\
debian\
mint\
slitaz\
do
echo "You picked $distro" # = unexpected syntax error , echo...?
done
select is blue , distro & in are white? in should be different?
do is white, echo & done are blue? do & done should match?
What am I missing, if you can help?
Probably something obviously simple 
tutorial is tried in .rc & .sh
It isn't really the best idea to put the choices on multiple lines. This fixes the issue:
From:
Code: select distro in\
debian\
mint\
slitaz\
To:
Code: select distro in debian mint slitaz
That one change allows the script to work. However you are still stuck in the script. So you should add break (given this code at least).
Code: #!/bin/bash
echo "What distro do you like?"
select distro in debian mint slitaz
do
echo "You picked $distro" # = unexpected syntax error , echo...?
break
done
That will run without errors. Also I would put the choices into an array myself.
Thanks for your answer, but that was another layout option in the tutorial afterwards. Also a cat text.txt into $distro etc. But i'm not that good at this as im not on arrays yet
But why does it not compute as it is? Is it a newer syntax change? Have the commands changed slightly/syntax in the last few years? Or is sublime 3 not great for bash? As the tutorial uses vim. I chose sublime for Ruby & it's in the manager.
Posts: 342
Threads: 7
Joined: Aug 2018
Reputation:
58
dai-3 Wrote:Thanks for your answer, but that was another layout option in the tutorial afterwards. Also a cat text.txt into $distro etc. But i'm not that good at this as im not on arrays yet 
But why does it not compute as it is? Is it a newer syntax change? Have the commands changed slightly/syntax in the last few years? Or is sublime 3 not great for bash? As the tutorial uses vim. I chose sublime for Ruby & it's in the manager.
Well it should work if you removed the last slash, so:
slitaz\
would become just:
slitaz
Still IMO it doesn't make sense to put the choices on a separate line. I would recheck the tutorial. Does the final choice entry have a slash?
I really can't say about Sublime as I haven't used it before.
Jeremy (Mr. Server)
* Desktop: Ubuntu MATE
* Windows are for your walls, Apple is for your health, Linux is for your computer
|