Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Folks, making the switch from Win2k Server to WBEL. General newbie question. How do you run script files. I have several .bat files that I run on my Win2k Server, I'd like to be able to do the same thing in Linux, I'm sure this is possible I just don't know how to do it yet. Go easy on me, as I said, I'm new to Linux.
No batch files here. You'll have to convert them to shell scripts; check out Advanced Bash-Scripting Guide for some great help with that. Then to run them, cd to script directory and
Code:
./script-name
or
Code:
sh script-name
Try one and if that doesn't work, try the other. I can never remember the rules about that.
to run a script file, first make sure that the 'executable' bit is set in the file properties (it won't be by default, for instance if you use a text editor to create the file). this can be accomplished either at the command line - eg chmod +x filename, or using konqueror - right-click on the file and select 'properties'.
then, to actually run the file, you can either click / double-click on it from a gui, or from the command-line, prepend ./ to the beginning of the filename - eg, using the example above, you'd type ./filename then hit return.
the ./ tells the shell to use the current working directory, which isn't necessarily in the environment $PATH variable.
found my answer:
- first I created my script file
- then I did a chmod +x on the file to make it executable
- then I moved it to the /bin dir
- open a new terminal window
- typed the name of my file and it runs my script
I would guess that there are other way to accomplish this since *nix is Script friendly, if you have other to suggest please let me know.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.