ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Distribution: Fedora mainly, but I am open to others.
Create and run a bash script
I want to create a shell script to run a few commands as opposed to having to enter them every time I want to do something.
Essentially it's about 6 commands that unloads a module and loads another for my wireless card and puts in a few settings. So, I know the commands, but I don't know how to create the shell script and run it. I know you do it in a text editor, just not sure what to save it as and how to run it when I want to.
If you could point me to a how-to or give me some pointers, I'd appreciate it.
That's a bit short plus the ABS might seem a bit intimidating to firsttimers. Basically a script contains the commands you run in your shell but with a starting line that reads "#!/path/shellname" and a ending line that reads "exit 0" (if you conform to standards) and some "basic logic" to deal with situations. If it's an initscript (you might call Wireless a networking subservice), things differ per distribution (please fill in your profile details) but at the same time you'll have the examples right there. Your basic Bash scripting guides are: http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html http://www.tldp.org/LDP/Bash-Beginne...tml/index.html http://www.tldp.org/LDP/abs/html/ # this one not being that basic, OK.
no need to give group/others execute perm (unless there really is)
This is a small script that I use to make scripts executable , you can also create multiple executable scripts.
# mkexe script to make files executable
# can take multiple file names as arguments
# 755 = rwxr-xr-x
if (test $# != 0)
chmod 755 $*
echo The file $* has been made executable
ls -al $*
echo 'mkexe : arguments [ file1 ...... file N ]'
Actually, my point was you should only grant perms to those who need them, so normally only the owner needs eg 'rwx', not 'group' or 'others'.
If you need to share the functionality with your group, but not editing, then
too many people just go
which allows user,group and others aka world(!) execute perms. Not a good habit to get into...