Results 1 to 3 of 3
hello, i am writing a small script to take care of some things when booting my knoppix disk. i cannot get any functions or aliases to work. i am sending ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-20-2006 #1Just Joined!
- Join Date
- Nov 2006
- Posts
- 90
script will not allow functions to work
hello, i am writing a small script to take care of some things when booting my knoppix disk. i cannot get any functions or aliases to work. i am sending these commands in the script:
function jdw () { alias list="ls /mnt/"; }
jdw
function jdm () { alias bdc="bdc --arc --delete --moves"; }
jdm
i start the script with #!/bin/bash
but have tried #!/bin/sh
also i have tried just the alias but with the shopt -s expand_aliases command and it also fails. everything else in the script works.
- 11-27-2006 #2Just Joined!
- Join Date
- Nov 2006
- Posts
- 90
ok then
no takers? well, can someone write a script that odes these things?
- 11-27-2006 #3Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,202
Hi.
Your code seems to work for me:
which produces when run:Code:#!/bin/sh # @(#) s1 Demonstrate functions. function jdw () { alias list=" echo ls /mnt/"; } function jdm () { alias bdc=" echo bdc --arc --delete --moves"; } echo " Activate the aliases." jdw jdm echo echo " Try the alias." list bdc
Note that I added an echo so that you know the alias definition has worked ... cheers, drlCode:% ./s1 Activate the aliases. Try the alias. ls /mnt/ bdc --arc --delete --moves
Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )


Reply With Quote
