LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-10-2019, 09:11 PM   #16
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,844

Rep: Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320Reputation: 1320

On some platforms bash is not part of the default installation. (Aix is an example. It has ksh, awk and Perl.)
 
1 members found this post helpful.
Old 09-11-2019, 12:28 PM   #17
YesItsMe
Member
 
Registered: Oct 2014
Distribution: Gentoo
Posts: 557

Rep: Reputation: 210Reputation: 210Reputation: 210
No shell which is not bash is bash-compatible.
 
Old 09-12-2019, 12:09 AM   #18
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,307
Blog Entries: 9

Rep: Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309
Quote:
Originally Posted by boughtonp View Post
Are there any systems where #!/bin/bash (as opposed to #!/bin/sh) will execute a shell that is not Bash-compatible?
Not to my knowledge.
The instruction the hashbang gives is clear.
However, somebody (idiotic) could have symlinked another shell to /bin/bash...
 
Old 09-12-2019, 03:09 AM   #19
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Slack, Debian, Mint, Puppy, Raspbian
Posts: 3,462

Rep: Reputation: 218Reputation: 218Reputation: 218
Quote:
Originally Posted by ondoho View Post

However, somebody (idiotic) could have symlinked another shell to /bin/bash...
It's not uncommon
Code:
# ls -l /bin/sh  
lrwxrwxrwx 1 root root 4 Aug 28 11:54 /bin/sh -> bash
but bash is not sh compatible in my experience, on other systems
 
Old 09-12-2019, 02:04 PM   #20
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,307
Blog Entries: 9

Rep: Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309
Quote:
Originally Posted by bigearsbilly View Post
It's not uncommon
Code:
# ls -l /bin/sh  
lrwxrwxrwx 1 root root 4 Aug 28 11:54 /bin/sh -> bash
but bash is not sh compatible in my experience, on other systems
nono, this is normal. I meant the other way round, e.g.:
Code:
# ls -l /bin/bash  
lrwxrwxrwx 1 root root 4 Aug 28 11:54 /bin/bash -> dash
That would be truly idiotic IMHO. Never seen that though.
 
Old 09-12-2019, 02:39 PM   #21
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: CentOS, MacOS, [Open]SuSE, Raspian, Red Hat, Slackware, Solaris, Tru64
Posts: 1,478

Rep: Reputation: 154Reputation: 154
Quote:
Originally Posted by MadeInGermany View Post
How compatible is python 3 with python 2? One day you will be confronted with python 4 versus python 3.
The Python 2<==>Python 3 differences aren't earth-shattering but are annoying. Fixing "print" statements is pretty easy. The integer math changes were a bit sticker. There are likely other, more subtle, differences that I'm not yet aware of. I've drawn a line in the sand and made a decision to do everything as Python 3 as I'm still learning it -- it's soon going to be the only game in town anyway (https://www.theregister.co.uk/2019/0...python_2_2020/) -- and I can easily make the decision to avoid Python 2.x-isms. Unfortunately, I'm sure I'll have to bone up on those, though, as I encounter older Python scripts at work. (And have to modify those to remain supported.)

I haven't run into any problems with bash syntactical changes over the years. One can easily imagine the great gnashing of teeth that would result from such a move. (No... I don't think that backticks vs. "$( )" counts as a syntax change.)

Cheers...
 
Old 09-12-2019, 05:14 PM   #22
boughtonp
Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 32

Rep: Reputation: 1
Quote:
Originally Posted by NevemTeve View Post
On some platforms bash is not part of the default installation. (Aix is an example. It has ksh, awk and Perl.)
I'm less bothered about what's available by default, (Bash for Aix is available at http://www.perzl.org/aix/index.php?n=Main.Bash), ondoho has answered my question...

Quote:
Originally Posted by ondoho View Post
...the other way round, e.g.:
Code:
# ls -l /bin/bash  
lrwxrwxrwx 1 root root 4 Aug 28 11:54 /bin/bash -> dash
That would be truly idiotic IMHO. Never seen that though.
Yeah, that's what I was asking about - to confirm that using Bash-specific features in a #!/bin/bash script is safe (barring deliberate idiocy/sabotage).

If the script doesn't run and needs to be checked & re-written, that's fine - if it could silently behave differently then that would be another matter.

Last edited by boughtonp; 09-12-2019 at 05:15 PM.
 
Old 09-13-2019, 12:53 PM   #23
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,745

Rep: Reputation: Disabled
Quote:
Originally Posted by boughtonp View Post
Yeah, that's what I was asking about - to confirm that using Bash-specific features in a #!/bin/bash script is safe (barring deliberate idiocy/sabotage).
Mostly, some features are only available in newer bash versions.
 
  


Reply

Tags
automation, bash, deploy, python


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: OpenStack automation with cloud deployment tools LXer Syndicated Linux News 0 09-12-2014 12:14 PM
[SOLVED] redhat deployment with Altiris HP Rapid Deployment Tool lievendp Linux - Server 2 08-03-2011 03:11 AM
LXer: Python Python Python (aka Python 3) LXer Syndicated Linux News 0 08-05-2009 08:30 PM
deployment/scripting/automation kevinyeandel Linux - Server 3 02-09-2009 12:51 AM
Kickstart automation deployment help bbmak Linux - Enterprise 5 02-20-2007 02:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:58 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