Script call : head: command not found


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script call : head: command not found
# 1  
Old 10-22-2010
Script call : head: command not found

Hi,

i am launching a script which open a ssh connexion to a cluster's node. Once on the node, the script calls the problematic command head and wc.

I receive a message error as follow which come from two different scripts :

line 31: head: command not found
line 18: wc: command not found

After reading on the forum, it seems that this problem might be related to the shell I am using.

right now i am calling :

./launchTest 2 3

and after calling echo $0, i can see that my shell is : -csh

What is strange is if i type the head command exactly like in the script but directly from the command line of the node, it is working.
whereas when head or wc is called from the script, it doesnt work.

I noticed that both scripts which calls head and wc are starting with : #!/bin/bash

so i tryed to launch the script with the shell bash but I have the same problem.

Anybody has a solution or any idea because I am totally blocked right now.

Thanks in advance.

Samy Merzgui
masy1800
# 2  
Old 10-22-2010
Execute the command bash to get into a bash shell and then execute this:
Code:
type head wc

That should tell you the paths that those commands are in:
Code:
head is /usr/bin/head
wc is /usr/bin/wc

If not, then your PATH variable is probably wrong, or maybe your system is missing some core files.
Execute this to see your path:
Code:
echo $PATH

# 3  
Old 10-22-2010
Hi,

I typed the command you proposed and I have :

head : /usr/bin/head

and the same for wc : /usr/bin/wc

Then maybe my path is wrong, i type echo $PATH and here is what i get.

How to know what is wrong ?

Code:
PATH={/usr/syscom/opt/moab/default/bin:/usr/syscom/opt/torque/default/bin:/usr/common/usg/bin:/usr/common/mss/bin:/usr/common/nsg/bin:/usr/common/usg/openmpi/1.4.2/pgi/bin:/usr/common/usg/pgi/10.8/linux86-64/10.8/bin:/usr/syscom/opt/moab/default/bin:/usr/syscom/opt/torque/default/bin:/usr/common/usg/bin:/usr/common/mss/bin:/usr/common/nsg/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/global/u2/s/samy/program/Swig/bin}:/global/u2/s/samy/program/Swig/bin:/global/u2/s/samy/program/Swig/bin

i see something strange, that the /Swig/bin was added 3 times. you think this could be an explanation ?

I can not try it right now because the cluster just passed in maintenance mode 5 mins ago...(bad timing).

I will try to erase this triple call to /Swig/bin as soon as it is back on
masy1800
# 4  
Old 10-22-2010
Wow! That's kind of a mess. Those curly brace characters {} don't belong there.

But I do see /usr/bin, and the type command found the executables, after all.

Oh wait! Rereading your original post I see you are opening an SSH connection to another host and the problem happens over there. Right? So the path problem is probably over there.

Do you have your own account on that host?
Cluster? I haven't used a cluster since the VAX/VMS days, but maybe that that means you have one account that works on any host in the cluster.

In any case, hopefully you can SSH directly to it and investigate:
ssh OTHERHOST
This User Gave Thanks to KenJackson For This Post:
# 5  
Old 10-22-2010
Agreed $PATH is a mess.

@masy1800
Please post any relevant script line which mentions $PATH.
We are probably looking for a line which is missing a $ sign or contains the wrong sort of quotes.
# 6  
Old 10-23-2010
HI Methyl,try using .(dot) command before head which will run in the current shell,hope it will work for you.

regards,
Sanjay
# 7  
Old 10-23-2010
@sanjay.login
Please read the previous posts. The O/P is masy1800. The problem is an error in a script which we haven't seen yet.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check file if not found send mail if exit call second script

I need to check my script and change to working mode. currently it was not sending the mail and exit without calling the second script. I need to check the file is present ="/home/Rvtools/test.csv" if this file not found after the time retry send mail file not found If the file exit run the... (2 Replies)
Discussion started by: ranjancom2000
2 Replies

2. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

3. Shell Programming and Scripting

How to call a bash command from within a perl script?

In a bash script, one can call a perl command in the following manner, where "myperlcommand" is a perl command. perl -e 'myperlcommand(arguments)' perl -e 'print("UUUU"x4)' Now, how can one call a bash command from within a perl script? (Suppose that mybashcommand is a bash... (1 Reply)
Discussion started by: LessNux
1 Replies

4. Shell Programming and Scripting

help a beginner, expect script, command not found

hi, i have a problem with my expect script, here is MyScript: #!/usr/bin/expect set pass set c set command spawn sudo $command expect "assword" send "$pass\r" expect eof My problem is that when i execute MyScript with the command : "./MyScript mypassword apt-get_install_git"i get... (6 Replies)
Discussion started by: gongotar
6 Replies

5. Shell Programming and Scripting

How to call the System command twice in the same perl script...

Hello experts, I have a perl script which looks for the ARGV and then loads the data as per it. Example. #Checking the server to connect if ($ARGV eq 'QA') { $ENV{"ORACLE_HOME"} = "/oracle/product/11.2.0"; $ENV{"PATH"} = "$ENV{'PATH'}:/oracle/product/11.2.0/bin"; ... (1 Reply)
Discussion started by: msrahman
1 Replies

6. Shell Programming and Scripting

shell script similar to the command HEAD

hello please if anyone can help me make a shell script similar to the command HEAD and TAIL THANKS (3 Replies)
Discussion started by: BELLA86
3 Replies

7. Shell Programming and Scripting

Imitate head and tail command script

Hi, I have been given assignment of 30 scripts out of which I was able to solve many, I need help with few out of which one asks to imitate head and tail command of unix without using the head and tail commands. Problem is stated below: Write an interactive shell script to imitate the head... (5 Replies)
Discussion started by: nutalk
5 Replies

8. Shell Programming and Scripting

command << EOF(dont want to call other script)

Dear Freinds, Help needed in input redirection . My problem is as follows.. I have a shell script as follows which calls another gnuplot script . datagen.sh #!/bin/ksh gnuplot plot_I.plt In the above file I am calling another file called plot_I.plt which reside in the same... (4 Replies)
Discussion started by: user_prady
4 Replies

9. UNIX for Dummies Questions & Answers

how can call perl script as command?

Hello say i have written some perl scripts , now i like to call them in my unix shell as unix command like "more" , "ls" , "grep" so that my say perl script called "foo.pl" will be called from every where as "foo" or "foo arg1 arg2"? Thanks (1 Reply)
Discussion started by: umen
1 Replies
Login or Register to Ask a Question