Mailinglist Archive: opensuse (2886 mails)

< Previous Next >
Re: [SLE] Shell Scripting Problem
  • From: JW <jw@xxxxxxxxxxxxxxxxxx>
  • Date: Fri, 8 Feb 2002 11:08:39 -0600
  • Message-id: <20020208170903.5773D33648@xxxxxxxxxxxxxxxxxxxxxxx>

SC >>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

SC >> jw@suse3:~/dl/Pantomime > ls -l /bin/sh
SC >> lrwxrwxrwx 1 root root 4 Sep 22 18:21 /bin/sh -> bash

SC >
SC >I'm not sure I understand what you are suggesting (I know, I'm thick) ...
SC >I know that my shell is /bin/sh (same as on the university's computer),
SC >and I know that the script is executing somewhat, so I don't think I need
SC >to be root to run it properly.

No no, has nothing to do with root. What I'm suggesting is that it might now be the shell you think it is.
On SuSE (Which I presume you are using, yes?), /bin/sh is a symlink to /bin/bash, so when you run /bin/sh you're actually running bash.
Furthermore, it's bash2.

Were you using bash2 on Solaris? I kinda doubt it.
Read the manual page for bash, it talks about various switches you can use for debugging in order to discover exactly where your script breaks.

SC > What am I looking for?

I my example, you were "looking" to see what shelll you are really using.

SC > I'm trying to
SC >figure out why it's not executing EXACTLY like it did on the Sun OS
SC >server.

I assure you that it's because it's not the same shell.

SC >If it could somehow make a difference, I did copy the folder
SC >holding the script onto a floppy from a Windows 2000 box at work, and
SC >then copied it into my home directory on my Linux box.

It would make no differance at all unless you did it by opening the file in an editor and chooseing "Save As"... which might convert it to DOS line endings.

Also, I just went back and read your originall post. It looks to me like you wrote it under bash (bourne shell) and now you're tring to run it under csh?
You said chsh but there's no such shell, on SuSE csh would probably be tcsh.
A bash script will _not_ run properly under csh.

It would be good if you'd forsake the use of /bin/sh and call either bash or tcsh explicitly.

-------------------------------------------------
Jonathan Wilson
System Administrator

Cedar Creek Software http://www.cedarcreeksoftware.com
Central Texas IT http://www.centraltexasit.com


< Previous Next >
Follow Ups
References