Wie kann ich aliase (oder was ist der plural von alias

Code: Alles auswählen
root@gms1:~# cat x.sh
#/bin/sh
alias xx="ls -l"
shopt -s expand_aliases
xx /tmp
root@gms1:~# ./x.sh
insgesamt 40
drwx------ 2 root root 4096 2006-08-26 12:37 atop.d
drwx------ 3 gms gms 4096 2006-08-26 12:32 gconfd-gms
drwx------ 3 root root 4096 2006-08-26 12:33 gconfd-root
drwx------ 2 root root 4096 2006-08-26 12:33 libgksu-w5ae7M
drwx------ 2 gms gms 4096 2006-08-26 13:46 orbit-gms
drwx------ 2 root root 4096 2006-08-26 12:33 orbit-root
drwx------ 2 gms gms 4096 2006-08-26 12:32 ssh-erloOx6725
drwx------ 2 gms gms 4096 2006-08-26 12:32 ssh-kOJDlJ6653
drwx------ 2 gms gms 4096 2006-08-26 15:28 v615934
drwx------ 2 gms gms 4096 2006-08-26 15:29 v616093
Code: Alles auswählen
alias foo="ls -l"
Code: Alles auswählen
#!/bin/sh
foo /
Code: Alles auswählen
$ chmod +x test.sh
$ test.sh
./test.sh: line 2: foo: command not found
Code: Alles auswählen
root@gms1:~# echo "alias xx='ls -l'" >>~/.bashrc
root@gms1:~# cat x.sh
#/bin/bash
shopt -s expand_aliases
. ~/.bashrc
xx /tmp
root@gms1:~# ./x.sh
insgesamt 40
drwx------ 2 root root 4096 2006-08-26 12:37 atop.d
drwx------ 3 gms gms 4096 2006-08-26 12:32 gconfd-gms
drwx------ 3 root root 4096 2006-08-26 12:33 gconfd-root
drwx------ 2 root root 4096 2006-08-26 12:33 libgksu-w5ae7M
drwx------ 2 gms gms 4096 2006-08-26 13:46 orbit-gms
drwx------ 2 root root 4096 2006-08-26 12:33 orbit-root
drwx------ 2 gms gms 4096 2006-08-26 12:32 ssh-erloOx6725
drwx------ 2 gms gms 4096 2006-08-26 12:32 ssh-kOJDlJ6653
drwx------ 2 gms gms 4096 2006-08-26 15:28 v615934
drwx------ 2 gms gms 4096 2006-08-26 15:29 v616093
Code: Alles auswählen
[ -z "$PS1" ] && return