Stacey
Stacey

Reputation: 5107

Command not found when trying to start Linux Bash script

I have a Bash script that I have been using for a while called launch.sh. This script launches a set of processes and the script looks like:

for ch in job_lists/*; do
  merlin mkt -log 30 -rollList $ch > "output_$(basename $ch)" &
done

The script pickups a set of 6 jobs from the job_lists and then executes line 2 where another script merlin is called. When I launch the script I get the following returned to the console:

enter image description here

I looks like it picks up the 6 jobs (hence the 6 lines of output), but I think it can't find merlin....

I've just moved my environment to a new laptop and copied over all my scripts. The merlin script is there and I have tried chmod +x launch.sh and chmod +x merlin.sh without success. I have even tried adding #!/bin/bash at top of the script without success.

merlin is located at:

enter image description here

I have checked my PATH (see below), I may have missed something but it looks like the PATH to merlin (home/scoleman/user/bin) is present.

enter image description here

Upvotes: 1

Views: 4736

Answers (4)

Anuradha Fernando
Anuradha Fernando

Reputation: 1157

  1. Make sure the merlin has execution permission, if not set it by,

    chmod +x merlin

  2. Make sure the merlin script is residing in the same location as the launch.sh, if not give the correct path to the merlin command,

for ch in job_lists/*; do   
<PATH_TO_MERLIN>/merlin mkt -log 30 -rollList $ch > "output_$(basename $ch)" & 
done

or add the merlin location to the PATH environmental variable.

export PATH=$PATH:<PATH_TO_MERLIN>

Upvotes: 1

Adam
Adam

Reputation: 138

This means that your merlin.sh script is not in the executing users PATH. Either add the script to a place that your path already points to, add the directory where your script lives to your PATH, or specify the full path to the script from the launch.sh script.

Upvotes: 2

Mathieu Vincent
Mathieu Vincent

Reputation: 31

You have to specify the path of the script.

Try this :

for ch in job_lists/*; do
    ./merlin.sh mkt -log 30 -rollList $ch > "output_$(basename $ch)" &
done

Upvotes: 2

Karma Exists
Karma Exists

Reputation: 1

run it without extention maybe it works,.

Upvotes: 0

Related Questions