converting text file to a cmd file
I realize I should know this. What do I do next when I have created a text file called ngstart.cmd which has the following command in it: sudo /etc/init.d/nagios start. It seems I recall you have to do something with the file to make it execute when it is typed in at the prompt.
Thanks in advance, Marty |
In order to be executed a file should have the executable bit set, at least for the file owner, like this
Code:
-rwxr--r-- 1 colucix users 170345 Apr 10 18:25 ngstart.cmd Code:
./ngstart.cmd |
You are correct; you should know this, but since command lines in all flavors of UN*X are best described as "wild conventions flying in loose formation", your memory lapse is hereby absolved:
Code:
#chmod ug+x ngstart.cmd |
Hi,
You can execute the file by doing the following: sh file Or parse the file by doing: . file If you want to make it an actual shell script, add a hash-bang and give it the proper execution rights: Add a hash-bang: #!/bin/bash Should be the first line of the script/file. Change permissions: chmod 750 file You can now execute it as follows: ./file If the directory that the file is in is part of your PATH, you don't even need the ./ Hope this clears things up. |
All times are GMT -5. The time now is 08:35 PM. |