Simple bash scripting question

Joined
Apr 30, 2009
Messages
1
Reaction score
0
Points
1
I have created a simple bash script, ( name: takeback.sh )

It is in a directory that is part of my path ( I added this in .profile ).
echo $PATH shows this to be true.

The first line contains:
#!/bin/sh

I have the execute attribute set properly. ( chmod 777 takeback.sh )

In terminal, if I type in takeback.sh ( from any working directory ), the script executes as expected.

But if I simply type in takeback, I get "command not found".

Is this a terminal issue, or a scripting issue?
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
Your problem is that you told the system to run takeback, which does not exist. That is why you get the error. just change the name from takeback.sh to takeback. Then you can enter only takeback. The only reason for the .sh extension is to remain you of the type of file, just by looking at it.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top