Dear All,
I have a script on my USB and I want to execute it on set of files when I connect via ssh on the server ...
I'm not able to define the path of the script located in the USB ... how can I use this script without copying/moving it into the directory I'm working on in the ssh mode ....
Please dont mind my non programming manner of description ... I'm just a beginner ...
Cheers 
---------- Post updated at 06:19 AM ---------- Previous update was at 06:16 AM ----------
all righty then -- you might try:
% ssh remote_host "
`cat my-usb-script`
"
btw -- that does work . . . but it might take some interesting editing of your script to account for path's, environments, etc...
hey did u get ur answer . Are u able to go to the USB device by cd command from any unix path . Or u want to know how to run a shell script or command after connecting to a machine with ssh connection .
I didnt understand how to do that .... can u please explain ?
Basically the .sh script is executable in USB but I am working in a directory on a remote server connected by ssh ... so instead of copying the script to this directory I would like to give path to this script and run it over files in the relevant directory.
The path of the script is /Volumes/USB/script
but when I'm in ssh usinf bash shell I'm unable to do
$ sh /Volumes/USB/script file
Hope its clearer ... will apreciate your help ..... I could copy the script in the directory to work but I want to know the alternate way. I think the script path needs to be added to my $PATH in ssh but I have no idea to do this
Cheers 
That's a useless use of cat, and assumes the script is small enough to fit in a shell variable. Using the actual file where possible is preferable, and it is possible here:
ssh username@host exec /bin/sh -s param1 param2 ... < /path/to/local/script.sh
This way also lets you pass commandline parameters, and use your shell of choice instead of getting whatever happens to be your login shell.
This is the kind of stuff I need but it didnt work ..... basically I get:
exec /bin/sh -s myfile_to_analyse ... < /Volumes/USB/gff_genotype_base_counter.sh
-bash: /Volumes/USB/gff_genotype_base_counter.sh: No such file or directory
When I have finished typing "... < /" and press "V" and tab to autocomplete Volumes ... it doesnt do it so I dont know whats the probmel but this option seems to be close to what I wan to do 
Let me know if u hv another idea
It means what it says: No such file or directory. Check to make sure the script's stored exactly where you think it is.
If you're trying to run a script that's on the remote server, not a local script, that's just ssh username@host exec /path/to/scriptfile.sh