Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem setting SHELL ENV variable to bash 1

Status
Not open for further replies.

mantab888

MIS
Nov 26, 2001
69
US
I'm using an Adduser perl script that came from a FreeBSD system on a Solaris 8 system and have tweeked most everything except that a couple of commands only work in a bash shell but the script tries (and fails) to run them in a Bourne (sh) shell.

I've set root' default shell to bash and tried a couple of ways in the script to set the shell:

$ENV{SHELL} = "/usr/local/bin/bash";
$shell = $ENV{'SHELL'};

Neither work. Can anyone assist in what I thought was a simple problem?
 
Here is what I modified:


###print `mkdir -m 755 /net/$ARGV[1]/$homed/$ARGV[0]`;
###print `cd /usr/local/share/skel ; cp * .[^.]* /net/$ARGV[1]/$homed/$ARGV[0]`;
###print `chown -R $ARGV[0] /net/$ARGV[1]/$homed/$ARGV[0]`;

use File::Copy;
use File::Find;
my $target = "/net/$ARGV[1]/$homed/$ARGV[0]";
mkdir( $target );
chmod( 0775, $target );
sub copy_and_chown {
copy($_[0],$target);
chown($ARGV[0],$_[0]);
}
find( \&copy_and_chown, '/usr/local/share/skel' );



Thanks!
 
Does anyone have a idea about what might be happening with this script change?
 
sorry about delay - not been well.

mkdir() takes one or two arguments and the code in your post clearly has only a single argument. I can think of three possibilities: (i) you've simplified or mistranscribed the code into the post and omitted something significant; (ii) you've got a path or test-script anomoly that results in you not running the code you think you're running or (iii) something in the runtime environment has overloaded mkdir with an incompatible prototype.

Sticking in an extra print statement and looking for it's output would prove that (ii) wasn't the case. To eliminate (iii), try specifying CORE::mkdir.

Other than that, I'm baffled..

f



"As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilkes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top