You are not logged in.
Pages: 1
I always thought these were aliases. But LSing around / has blown my mind. They're actually symlinks.
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgcfgbackup -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgcfgrestore -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgchange -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgck -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgconvert -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgcreate -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgdisplay -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgexport -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgextend -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgimport -> lvm
-r-xr-xr-x 1 root root 11K Jul 11 03:22 vgimportclone
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgmerge -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgmknodes -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgreduce -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgremove -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgrename -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgs -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgscan -> lvm
lrwxrwxrwx 1 root root 3 Jul 11 03:22 vgsplit -> lvm
There are other examples of these around the FS. How do you link to TARGETPROGRAM w/ parameters? And why would you use this over an alias?
Last edited by ernesto (2010-08-30 07:08:00)
Offline
The 'lvm' program will look at the name it was called by and behave appropriately. You can't pass arguments to a target when creating a symlink.
It is totally different to an alias.
a) How does the program developer know if the user is using bash, csh, tcsh, zsh, fish, dash or sh to setup the alias?
b) Where does the program developer define the alias to ensure *every* user loads it?
Edit.
To make an app like lvm in bash:
#!/bin/bash
ME=`basename $0`
case $ME in
pvchange)
echo "I'm pvchange!"
;;
vgchange)
echo "I'm vgchange!"
;;
lvchange)
echo "I'm lvchange!"
;;
esac
exit 0
Name this whatever you like, then symlink 'pvchange', 'vgchange' and 'lvchange' to that file and execute.
Last edited by fukawi2 (2010-08-30 07:29:31)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Pages: 1