• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Creating Linux shell script

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.


Apr 30, 2001
I am trying to create a script for linux that allows you of all things to change the desktop trash icon. I know it is pretty easy to log into x windows as root and copy then paste it to the right directory but I thought this would make it easier. I have two problems so far. The first is that when I use the su command in the script to have the user login as root to start out the rest of the script won't continue until you exit being root. The second problem is that I don't know how or can't find any information on how to get a script to accept an input into the command line and then do something with it. For example I would use echo to display something like "Please type the path to the file you want to use". The user types the path and presses enter then the script copies that file to the right place. Any help?
'su -c user class ' where user class would be root; read 'man su' for more info. I'm pretty sure that that command will run the script as if it were being run as root.

To accept, and pass input you'd have to do something like this:

declare a variable that will store the input string something like '$input'
and then somewhere else in you script have the have it run the command like
'command $input'.

You might want to try this link about introductory bash programming:

And for more info just do a google search on bash programming, or shell programming.