roly
06-22-2002, 11:41 PM
how:confused:
thanks
thanks
![]() | View Full Version : Like MS-DOS batch file but for Linux? roly 06-22-2002, 11:41 PM how:confused: thanks ffeingol 06-22-2002, 11:50 PM Umm, it's just like writing a dos batch file, but you don't need the extension. Assuming you're using bash as a shell, make the first line of the scirpt: #! /bin/bash And then just type the commands you want to execute. Change the script to be executable and presto! shell script. That first line tells the shell to run this script under bash. If you can give more details, I can give a more specific example. Frank roly 06-23-2002, 12:01 AM thanks! :) clocker1996 06-23-2002, 01:30 AM its called shell scripting! hehe roly 06-23-2002, 05:54 AM I have one question, if I put echo "test" in one of those files and run it, what would it output? echo "test" test or just test clocker1996 06-23-2002, 06:18 AM the second e..g if i type pico file.sh #!/bin/bash echo yo whats your name read name echo hey whats up $name then save that file chmod +x file.sh then type ./file.sh you will see roly 06-23-2002, 07:42 AM now how do i make a command run in it, but not output anything? clocker1996 06-23-2002, 09:01 AM ./file.sh>/dev/null& will make it not output anything and put it in the backround ./file.sh>/dev/null will just run it and not show any output you prolly wanna use choice #2 bambenek 06-23-2002, 12:12 PM Don't tell him to make BASH shell scripts?!?!? #!/bin/ksh Sheesh. rfxn 06-23-2002, 01:35 PM ksh! akk - you mean csh dont you - yes you do :P clocker1996 06-23-2002, 03:17 PM who cares ffeingol 06-23-2002, 03:25 PM Well you'll care a little bit ;). Most systems won't have /bin/ksh on them unless you've installed pdksh. And there are syntax differences between /bin/csh, /bin/sh and /bin/bash. Frank FDrive 06-23-2002, 04:55 PM Originally posted by ffeingol And there are syntax differences between /bin/csh, /bin/sh and /bin/bash. Precisely why I use a universal language, Perl, to do all of my scripting :D xerocity.com 06-24-2002, 05:23 AM Originally posted by FDrive Precisely why I use a universal language, Perl, to do all of my scripting :D I second that ;) ffeingol 06-24-2002, 07:07 AM Originally posted by FDrive Precisely why I use a universal language, Perl, to do all of my scripting :D Well I generally agree with you, but perl can have "some" of the same issues. You need to make sure that the same version/modules etc. are installed on each box you want ot run the script on. Frank blazenet 06-24-2002, 07:39 AM I just always prefer shellscripting ;) |