LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Creating an icon on all user's desktops (https://www.linuxquestions.org/questions/slackware-14/creating-an-icon-on-all-users-desktops-655764/)

Muzzaw 07-14-2008 08:32 PM

Creating an icon on all user's desktops
 
Hi all,

Relatively new to Linux and any help is appreciated.

I would like to set up a link to "konsole" on all my user's desktops. Rather than typing:
Code:

ln -s /usr/bin/konsole /home/USER_NAME
multiple times, is it possible to execute the command once and have the link populate to all user's desktops?

I'm looking through the man page for "ln" but cannot see options for multiple destination directories, or any clues as to how I can pull this off.

Can anyone point in the direction of further reading to help solve this?

Cheers,
James.

gregg_a_g 07-14-2008 09:29 PM

How about this. At a command prompt as su, type:

for i in /home/*; do ln -s /usr/bin/konsole $i;done

Muzzaw 07-14-2008 09:32 PM

Thanks alot! I'll have a go when I get home.

But will that end up placing multiple icons on desktops that already have the icon on them?

Cheers,
James.

Muzzaw 07-14-2008 09:34 PM

I'm still getting familiar with the syntax of the shell. Is it possible to implement your above script, but run a check to see if the link is present on the user's desktop?

gregg_a_g 07-14-2008 09:59 PM

How about this then? At a command prompt as su, type:

for i in /home/*; do ln -sf /usr/bin/konsole $i;done

The difference is the "f". That means, "force", or "remove existing destination file". So if you already have a link, the "f" will clobber the file and overwrite. If you don't use the "f" and there is already a link, you won't get "multiple" icons. The little shell thingy will just fail at some point. So you might not get all of the links in.

It will be safe to use the line as shown above. :)

Muzzaw 07-14-2008 10:19 PM

Thanks, I'll give it a shot and you let you know how I get on.

Would you mind explaining the syntax of the 'for' loop you've used? It looks pretty simple, but is different than what I'm used to.

Thanks again,
James.

gregg_a_g 07-14-2008 10:36 PM

For reference on the bash shell, you can look here:

http://www.gnu.org/software/bash/manual/bashref.html

or for more advanced topics:

http://tldp.org/LDP/abs/html/

Have fun! :) :study:

Muzzaw 07-14-2008 11:09 PM

Some nice bedtime reading, thanks!


All times are GMT -5. The time now is 11:55 PM.