path not working when executing from script...

Hello,
Upon upgrading to suse11.2, I’ve noticed a reoccurring problem.

I use tcsh. When I execute by hand a command that is in my path…located in say “~/bin/myscript”…the command executes without an issue. I don’t need to use the absolute path “~/bin/myscript”, I can simply type the command “myscript” since the path “~/bin” is in my .tcshrc file.

When I execute the same command from a script, I get a “command not found” error. A similar issue is when I use the absolute command, but a library necessary the programs’ execution is defined within my .tcshrc file. I’ll get a library not found error.

I didn’t have this issue with earlier versions of suse.

Thanks for any help,
Paul

Additional info that I just realized is relevant:
The system is a cluster with nodes nfs-mounting user directories from the server’s /home/ directory. I submit jobs via a ssh command such as " ssh mymachine myscript".

When I run "ssh mymachine ‘which ls’ " I get back the path “/bin/ls” like I should. If I run "ssh mymachine ‘which myscript’ ", I get a command not found error. If I run “which myscript” I get the correct path.

As mentioned, all machines use the same .tcshrc file because they all share the same nfs mounted directory.

Reading* man ssh* I found following:

If command is specified, it is executed on the remote host instead of a login shell.

which is about the command parameter in your ssh call (the “which ls” or the name of your executable script).
and:

PATH
Set to the default PATH as specified when compiling ssh .

and I doubt that ssh is compiled while* ~/bin/myscript* was one of the items in the PATH environment variable.

And when it executes that command it nowhere says that it does so using any shell at all.

Thanks for the reply.

I have been running the same scripts since suse10.0 and have only recently had this issue.

Short of reinstalling ssh on all my nodes, do you have a suggested fix.

Right now, as a work around, I use a wrapper script with a explicitly defined shell.

I can not tell why it worked in 10.0 where it shoud not work also :slight_smile:

For a solution look in that man page. Browse a bit, there are several places where adding something to a PATH is mentioned, but I do not think I should read them all where you can do this yourself. Also I do not use tcsh here for testing.

As a follow-up, this was my eventual solution.

I created a wrapper script that explicitly defined the shell I needed. So instead of executing “ssh myscript”, I’d make a wrapper script “mywrapper” that has the shell information necessary for my target executable.

mywrapper:
#!/bin/tcsh
myscript

So my final execution is “ssh ~/pathtofile/mywrapper”

Still a mystery why this seemed unnecessary for previous releases.