Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: getting a problem when I use which command with system function

by sgifford (Prior)
on Nov 03, 2006 at 06:07 UTC ( [id://582011]=note: print w/replies, xml ) Need Help??


in reply to getting a problem when I use which command with system function

Look around in your dotfiles (or the dotfiles of the user running the script), like .profile, .bashrc, .cshrc, etc. I bet one of these is running machtype, and it's not in the path or is an undefined shell function.

Update: Fixed forrmatting error.

  • Comment on Re: getting a problem when I use which command with system function

Replies are listed 'Best First'.
Re^2: getting a problem when I use which command with system function
by greatshots (Pilgrim) on Nov 03, 2006 at 07:40 UTC
    thanks a lot sgifford.
    #setenv MACH `machtype`
    found in $HOME/.cshrc. I commented this line. after that I got the expected behaviour from my perlscript.

      I actually ran into a problem with 'which' and a '.cshrc' file a week or two ago when doing some shell scripting on MacOS X

      In my case, it was much more subtle, as which was written in csh, but that wasn't the shell I was using. So when it called the .cshrc, it overwrote PATH, and would report programs that weren't in my path when I was using bash.

      (of course, which is a builtin under csh, so the odds of you calling the script under csh in normal use should be non-existant)

      Oddly enough, there's a note about 'DO NOT USE "csh -f"' immediately after the shebang line, which fixes the problem, but I have no idea what other implications it might have.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://582011]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-24 18:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found