Getting Command not found error Even though Script is working fine


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting Command not found error Even though Script is working fine
# 1  
Old 01-11-2013
Getting Command not found error Even though Script is working fine

Hi friends,

I am using below script to do some work. But even though script is working fine but while executing it i am getting command not found error. Smilie

Here is the script :-
Code:
#!/bin/sh
Names="name.txt"
 
###main#####
  for LINE in `cat ${Names}`
        do
                Name=`echo $LINE |awk -F'|' '{print $1}'`
           `<some Command>:$Name`
     echo $Name is unlocked
   done
echo "Unlocking is done"

NOte:- its reading Names one by one from file and executing some commmnad. Functionality is working fine but i am not sure whey
"./script.sh: line 11: Unlocked: command not found" is coming.



Regards
Harpal Singh

Last edited by harpal singh; 01-11-2013 at 04:47 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 01-11-2013
Code:
#!/bin/sh
Names="name.txt"
 
###main#####
  while read LINE # preferable to use while loop to read files
        do
                     Name=`echo $LINE |awk -F'|' '{print $1}'`
    <some Command>
    echo "$Name is unlocked"
   done < $Names
echo "Unlocking is done"

This User Gave Thanks to balajesuri For This Post:
# 3  
Old 01-11-2013
Run with option -x set and post log.
This User Gave Thanks to RudiC For This Post:
# 4  
Old 01-11-2013
Quote:
Originally Posted by balajesuri
Code:
#!/bin/sh
Names="name.txt"
 
###main#####
  while read LINE # preferable to use while loop to read files
        do
                     Name=`echo $LINE |awk -F'|' '{print $1}'`
    <some Command>
    echo "$Name is unlocked"
   done < $Names
echo "Unlocking is done"


Thanks Balajesuri for your help. But why my code was showing error? can you please explain a bit.?
I would like to add one more thing in my code which i have pasted eariler `<some Command>:$lableName` is `<some Command>:$Name`

Last edited by harpal singh; 01-11-2013 at 04:46 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed command not working inside ksh script but works fine outside

Hi, I am a bit confused ,why would a sed command work fine outside of ksh script but not inside. e.g I want to replace all the characters which end with a value and have space at end of it. so my command for it is : sed -i "s/$SEPARATOR /$SEPARATOR/g" file_name This is working fine in... (8 Replies)
Discussion started by: vital_parsley
8 Replies

2. Shell Programming and Scripting

Script runs in command-line fine but times out in CRON?

Hi, I have a script that seems to run to completion when in the command-line, but when it is run using the cron, it seems to time out. They both start and run fine, but on the CRON it stops prematurely. The script hits an API every few seconds and grabs data. Does anyone have any idea on... (4 Replies)
Discussion started by: phpchick
4 Replies

3. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

4. Shell Programming and Scripting

Sed script not working properly on Solaris (works fine on AIX)?

Hi, I have a problem with a SED script that works fine on AIX but does not work properly on a Solaris system. The ksh script executes the SED and puts the output in HTML in tables. But the layout of the output in HTML is not shown correctly(no tables, no color). Can anyone tell if there is... (7 Replies)
Discussion started by: Faith111
7 Replies

5. Shell Programming and Scripting

Shell script runs fine in Solaris, in Linux hangs at wait command

HI, I have a strange problem. A shell script that runs fine on solaris. when i ported to linux, it started hanging. here is the core of the script CFG_FILE=tab25.cfg sort -t "!" -k 2 ${CFG_FILE} | egrep -v "^#|^$" | while IFS="!" read a b c do #echo "jobs output" #jobs #echo "jobs... (13 Replies)
Discussion started by: aksaravanan
13 Replies

6. Shell Programming and Scripting

awk command in script gives error while same awk command at prompt runs fine: Why?

Hello all, Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val: > cat getnon0file.sh #!/bin/bash this="getnon0file.sh" USAGE=$this" InFile="xyz.38" Min="0.05" # awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
Discussion started by: catalys
4 Replies

7. Shell Programming and Scripting

#!/bin/bash and #1bin/sh command not found error on mac osx terminal/shell script

i am having a weird error on mac os x running some shell scripts. i am a complete newbie at this and this question concerns 2 scripts. one of which a friend of mine wrote (videochecker.sh) a couple weeks ago and it's been running fine on another machine. then last week i wrote capture.sh and it... (2 Replies)
Discussion started by: danpaluska
2 Replies

8. Solaris

GUI not working... CLI is working fine

Hello, I have X4500 running Solaris 10. I can access it through CLI but I cannot see the GUI. When I reboot it, the GUI works till all the files are loaded (ie., the initial boot sequence) and it prompts me to enter username and password and there it ends. The screen just has a blinking cursor... (4 Replies)
Discussion started by: bharu_sri
4 Replies

9. UNIX for Advanced & Expert Users

How to know whether my perodic thread is working fine

Dear All, I am using xenomai-2.4 along with linux kernel 2.6 In my application having following threads. 8ms perodic thread (RT TASK) 1ms perodic thread(RT TASK) 16ms perodic thread(RT TASK) 256ms perodic thread(RT TASK) 22 - pthread are condition based it may execute or else in... (1 Reply)
Discussion started by: rajamohan
1 Replies

10. Shell Programming and Scripting

NAWK Script not working fine

Hello to all can any one help me out with a nawk script. Actually i am having a shell script which uses nawk pattern searching and it is not parsing the file properly. I have been debugging it since long time, but nt able 2 find the root cause.. If any one can help me out with this one .. (3 Replies)
Discussion started by: dheeraj19584
3 Replies
Login or Register to Ask a Question