View Full Version : make a symbolic link file with parameters

2nd November 2004, 08:13 PM
I wanna make a symbolic link file to point a file with parameters, example
build file /tmp/myls to point to /bin/ls -ld /root/*.c
but ..... failed
ln -s '/bin/ls -ld /root/*.c' /tmp/myls :(
how can I build a symbolic link file with parameters ??
and then ......
I find /sbin/modprobe a symbolic link file :confused:
file $(which modprobe)
/sbin/modprobe: symbolic link to `insmod'

Why modprobe function is very different to insmod ??
very thx for any reply.

2nd November 2004, 08:17 PM
I would create a file like this:

ls -ld /root/*.c

And write it to /usr/bin/myls

That should work.

2nd November 2004, 08:31 PM
thx ,but .....
I want still build a symbolic link to point to it, :D
what with I wanna learn the method to build a symbolic link file with parameters
certainly , we can do alias myls=' ls -ld /root/*.c ' also. :D

2nd November 2004, 08:41 PM
Reading the manpages leads me to beleive that symbolix links are merely shortcuts, incapable of parameters. Good luck!

A symbolic link contains the name of the file to which it is linked. The referenced file is used when an open(2) operation is performed on the link. A stat(2) on a symbolic link will return the linked-to file; an lstat(2) must be done to obtain information about the link. The readlink(2) call may be used to read the contents of a symbolic link. Symbolic links may span filesystems and may refer to directories.

3rd November 2004, 12:01 AM
Indeed... reading up on file inodes (http://linuxgazette.net/105/pitcher.html) will explain why this isn't possible.

3rd November 2004, 04:12 AM
The reason those shortcuts work is that there's code built into the executable that checks arg[0] (the executable name) to see how the program was invoked and to execute the "changed" behavior automagically. Kind of a neat trick, actually...

3rd November 2004, 08:47 AM
thx Moderator, I see.