Issue with script in linux but in unix works


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Issue with script in linux but in unix works
# 8  
Old 05-01-2010
/bin/sh on linux is usually /bin/bash

and despite claims it's not compatible in my experience.
# 9  
Old 05-01-2010
Quote:
Originally Posted by bigearsbilly
/bin/sh on linux is usually /bin/bash

And if it's not, it will still be a POSIX shell.
Quote:
and despite claims it's not compatible in my experience.

Not compatible with what?

If you use bash extensions, then your script will not be compatible with the standard shell. If you use only POSIX syntax, it will.
# 10  
Old 05-03-2010
i'm using /usr/bin/sh that would be fine to use in lunux and hpux?
# 11  
Old 05-03-2010
Quote:
Originally Posted by C|KiLLeR|S
i'm using /usr/bin/sh that would be fine to use in lunux and hpux?

Linux doesn't usually have /usr/bin/sh, but you can link /bin/sh to it:
Code:
ln /bin/sh /usr/bin/sh  ## as root

I have no idea what shell /usr/bin/sh is on HPUX. If it works, use it.
# 12  
Old 05-03-2010
Quote:
Originally Posted by cfajohnson
If you use bash extensions, then your script will not be compatible with the standard shell. If you use only POSIX syntax, it will.
...except on solaris, whose default shell hasn't changed in ages beyond measure.
# 13  
Old 05-03-2010
Sorry, but Bash is not a fully POSIX-compliant shell. To quote from the Bash reference manual
Quote:
Starting Bash with the --posix command-line option or executing ‘set -o posix’ while Bash is running will cause Bash to conform more closely to the posix standard by changing the behavior to match that specified by posix in areas where the Bash default differs.
Not the wessel words "to conform more closely"!

See Bash POSIX Mode - Bash Reference Manual

Currently POSIX-compliance of a shell is defined by the VSC-PCTS2003 test suite. I do not believe that Bash will pass that testsuite.
# 14  
Old 05-03-2010
Quote:
Originally Posted by Corona688
...except on solaris, whose default shell hasn't changed in ages beyond measure.

On Solaris, /bin/sh is not a standard Unix shell.

I think the standard shell is /usr/xpg4/bin/sh.


---------- Post updated at 02:48 PM ---------- Previous update was at 02:34 PM ----------

Quote:
Originally Posted by fpmurphy
Sorry, but Bash is not a fully POSIX-compliant shell. To quote from the Bash reference manual

Not the wessel words "to conform more closely"!

http://tiswww.case.edu/php/chet/bash/bashtop.html:
"Bash is the GNU Project's Bourne Again SHell, a complete implementation of the IEEE POSIX and Open Group shell specification"
Quote:

See Bash POSIX Mode - Bash Reference Manual

Currently POSIX-compliance of a shell is defined by the VSC-PCTS2003 test suite. I do not believe that Bash will pass that testsuite.

Can you substantiate that?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Expect scripting issue, works interactively when doing commands in cli, does not work in script

Hi; problem may be obvious, simple but I have to say it is somehow not easy to locate the issue. I am doing some word extracting from multiline text. Interacting in CLI seems to work without issues. First step is to add multiline text to a variable. expect1.1> expect1.1> set... (2 Replies)
Discussion started by: aldowski
2 Replies

2. Shell Programming and Scripting

Why statement works in LINUX and not UNIX?

Hello, I have a ksh script that uses code below. For some reason it works under linux but fails in unix. Any idea why? if ]; then ... Thanks (9 Replies)
Discussion started by: rdogadin
9 Replies

3. Shell Programming and Scripting

Script works with Linux not with Solaris

Hi I have the following script which works in Linux shell but gives issues with Sun OS Solaris 5.10, What i am trying to achieve here is we have a list of file names in list.txt file and we parse each file at a time for a particular pattern and copt next 4 lines after we hit the pattern to a... (6 Replies)
Discussion started by: Yugendra
6 Replies

4. Shell Programming and Scripting

sed works on Linux and Unix does not work

Hi, I use this command in Linux but if I run the same command does not work in freebsd. Follow the below command: Linux works: sed -e '1731a\' -e '####' squid.conf > squid2.conf ; sed -e '1731a\' -e 'acl TESTE_ip src 192.168.1.1/255.255.255.255' squid2.conf > squid.conf ; sed -e... (7 Replies)
Discussion started by: andreirp
7 Replies

5. UNIX for Dummies Questions & Answers

FTP that works correctly in command prompt and shows issue in UNIX server

Hi All, FTP ports opens with the given user name and password and allows to download file through COMMAND PROMPT. Code as below: H:\>ftp ftpxxxxx Connected to entvc2ft07-pub.xxxxx.com. 220 Microsoft FTP Service User (entvc2ft07-pub.xxxxx.com:(none)): userxxxxx 331 User name okay, need... (1 Reply)
Discussion started by: vijayalakshmi.r
1 Replies

6. Shell Programming and Scripting

Works in shell but not script UNIX

ok i have a very simple UNIX script #!/bin/bash TERM=ansi;export TERM PFCMARK=25;export PFCMARK umask 0000 PFUMASK=000;export PFUMASK #run for filepro menus and exectuables echo "###########File Modification Log.############\r" > "/public/appl-fp$(date +%m-%d-%Y).txt" find /appl/fp/... (10 Replies)
Discussion started by: dunpealslyr
10 Replies

7. Shell Programming and Scripting

Execution issue with shell script - works in a different environment

Hi I get the following error while executing the shell script. I did not get an error when I ran the script in a different environment (unix server). str-token.ksh: 0403-057 Syntax error at line 20 : `(' is not expected. This is the line which gives error string=(${pos_array}) Please find... (3 Replies)
Discussion started by: hidnana
3 Replies

8. UNIX for Dummies Questions & Answers

what's the Linux|Unix OSes works on Servers

Hi everybody , I'm new here in the forum and new Dummy in L|U systems (Hope finding welcomes...:)). I just want to ask : What is the OS's that works on servers and the OS's that work as client OS?? I just know that Solaris Work on sarvers :D.. and i'm glad to be memmber in this... (1 Reply)
Discussion started by: derbi
1 Replies

9. Shell Programming and Scripting

Script works on Solaris, not on Linux

I'm in the same boat as Barbus - same exercis (https://www.unix.com/shell-programming-scripting/43609-processes-users.html) The following script works on a solaris server I have access to. It doesn't however, work on the companies Linux machine. Any idea what's up? I have very little shell... (1 Reply)
Discussion started by: Silverhood
1 Replies

10. Shell Programming and Scripting

Script works on Solaris, not on Linux

I'm in the same boat as Barbus - same exercis (https://www.unix.com/shell-programming-scripting/43609-processes-users.html) The following script works on a solaris server I have access to. It doesn't however, work on the companies Linux machine. Any idea what's up? I have very little shell... (0 Replies)
Discussion started by: Silverhood
0 Replies
Login or Register to Ask a Question