On 11 October 2010 23:45, Vic <l...@beer.org.uk> wrote:
>
>> After adding the folder that holds the "file" to
>> $PATH and then changing crontab to run from /folder/file.sh it would not
>> run But when I changed it to /folder/file it ran?
>
> Yes - exactly,
>
> The name of your script was "day1", IIRC. That's its name - calling it
> day1.sh doesn't work, because that's the name of a completely different
> file (that doesn't exist).
>
> You *also* need to tell the OS where to find your script - either by
> giving it an explicit pathname, or letting it find it by searching along
> $PATH - but that's entirely secondary to the problem of needing to use the
> right name in the first place.
>
>> I understood the part about the file did not exist, my problem was finding
>> out why it thought it did not exist
>
> Simply because it didn't exist. Your script was called "day1". "day1.sh"
> is not the same file.

I think perhaps an explanation that the file extension in linux
generally does not affect what the OS will do with the file. In gui
window managers, the extension is sometimes used to work out which
application to open it with, but when it comes to command line usage,
in particular executable scripts, the extension is purely a hint for
users.

If a file has the executable bit, then the OS will try and run it when
asked. If it is a text file, then it looks a the first line. If the
first line is #!/bin/bash (usually referred to as she-bang /bin/bash)
then when you run "./script" the OS will ask /bin/bash to run the
contents of the file, even if the file has an extension that might
suggest something else

Anton

-- 
Anton Piatek
email: an...@piatek.co.uk
blog/photos:            http://www.strangeparty.com
pgp: [74B1FA37]    (http://www.strangeparty.com/anton.asc)
fingerprint: 7401 96D3 E037 2F8F 5965  A358 4046 71FD 74B1 FA37

No trees were destroyed in the sending of this message, however, a
significant number of electrons were terribly inconvenienced.

--
Please post to: Hampshire@mailman.lug.org.uk
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--------------------------------------------------------------

Reply via email to