Can you help me create a list of shell scripts to make :)
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can you help me create a list of shell scripts to make :)
Hello everyone,
I'm getting my feet wet again and now I am determined to learn Bash (and thats the beginning. I'm so new to everything still that I am not sure of the possibilities.
I know the motto, to learn a programming language, two things are needed: write code and read code.
I want to learn how to write code. Could anyone give a me a list of tasks to automate that would require me to write shell scripts? Let your imagination run wild, the more tasks of varied difficulty, the better I will get and the more I will learn.
Write a script that take a word as a parameter, checks it to be only ASCII characters. Find this word in the input stream or file, capitalizes all letters in this word and write it to the output file.
You would be far better off defining something you want the computer to do, and use that as your learning tool.
I learned BASH because I wanted to gather data from a large LDAP directory and track some statistics over time. At the same time, I wrote a small script which just looks up phone numbers--crude, buggy, but faster than the official company web-based method.
The next project I have been noodling is batch-conversion of image files using the ImageMagick tool set. (eg down-sampling for e-mail)
You can write a post installation script, which could run all post-installation things you do after installing. It could save you lots of time if you're installing to different computers.
Read the info manual for the coreutils package. It contains a large number of base utilities such as ls and move, but also a large number number of text handling utilities such as cut, comm, sort, uniq.
Bash programs will assemble a series of these small dedicated utilities; piping the output of one to the input of another. If your programs use the read command, you are probably doing it wrong!
At work, I needed a way of producing a catalog of video files I backed up to DVD. I came up with a simple script that extracted the information from ls -l that I needed, used enscript to produce the catalog, and then used ps2pdf to create a file that I would save on the server. The other employees only need to double click on the file to open the file in acroread, and use [ctrl]-f to search for the particular file in the catalog. I installed cygwin on my work computer because the *nix utilities are so useful. I can't imagine how I would do this in windows. The backup program only produces an opaque file that you can only use with with the same program.
Be sure you look at the Advanced Bash Scripting Guide on the www.tldp.org website. It is a book composed of commented examples. Type in the examples your self as practice and for learning by doing.
Also, understand passing arguments to scripts and functions in a script. Using the getopts and case commands will allow you to write scripts that process arguments like regular commands do. Actually some commands that you use might be bash scripts themselves. One example in SuSE is the mkinitrd command. In Mandrake, it was a perl script.
I recently neeed to hone my skills in certain aspects of shell scripting and started writing implementations of several utilities from util-linux and coreutils in pure BASH. I got about 14 of them done, icluding cut, tail, wc, rev sort and others. It proved to be a good way to motivate my efforts, particularly because I had a list of programs that I needed to run in a shell-only environment.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.