If this is your first visit, be sure to
check out the FAQ. You will have to register
before you can post. To start viewing messages,
select the forum that you want to visit from the selection below.
Please do not use the CODE tag when pasting content that contains formatting (colored, bold, underline, italic, etc).
The CODE tag displays all content as plain text, including the formatting tags, making it difficult to read.
Announcement
Collapse
No announcement yet.
How to make a file in linux like windows .bat file
Re: How to make a file in linux like windows .bat file
Hi,
Well in linux/unix it's called a shell script and it's pretty much the same way as in windows. You open an editor (I like vi) but you can use any. Then type in the command you want to run, then save the file. You have to change the file permissions so that it is executable and then just run it. This is really over simplistic but gives you the general idea. Lot's of good info on scripting almost everywhere on the web.
Re: How to make a file in linux like windows .bat file
i opend kate and i wrote ping "and the ip" then i saved it on desktop..
its permissions are -rwxr-xr-r i think i made it executable.
how can i "run" it? ;p
Re: How to make a file in linux like windows .bat file
You can open a terminal (konsole, xterm, etc.) and run it from the command line.
-- contents of script --
#!/bin/sh
ping 127.0.0.1
-- end of file --
make it executable with 'chmod +x script'
run it with './script'
the ./ in front of the name is required because normally only programs/scripts which are in your $PATH will be executed. this way you tell it to execute a local file.
a good manual on how to do more advanced things would be the 'advanced bash scripting guide' (http://tldp.org/LDP/abs/html/).
Comment