home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.questions:15393 comp.unix.aix:13172 comp.unix.shell:5331
- Path: sparky!uunet!psinntp!alsys1!yu1.yu.edu!manaster
- From: manaster@yu1.yu.edu (Chaim Manaster)
- Newsgroups: comp.unix.questions,comp.unix.aix,comp.unix.shell
- Subject: Aliases in shell K-shell scripts.
- Message-ID: <1277@alsys1.aecom.yu.edu>
- Date: 10 Jan 93 21:08:52 GMT
- Sender: news@alsys1.aecom.yu.edu
- Followup-To: comp.unix.questions
- Organization: Yeshiva University
- Lines: 102
- Nntp-Posting-Host: yu1.yu.edu
-
-
- am having a problem trying to get some aliases that I have defined
- in .kshrc to be recognized by a shell script I use. The script,
- called menu.sh, invokes the alias names but then gets the
- response: alias-name not found.
-
- Do I need to do something special for a script to recognize the
- aliases in the K-shell?
-
- I am also trying to pass parameters to the alaises and that isn't
- working well either. What is the right way to do that. I am trying
- to use $*, but that isn't working to well. Someone suggested
- putting the $* reference into a function definition, so I tried
- that, --same difference, the parameters are ignored. Also the mv
- commands that follow the rnalias call, report back with usage
- error for mv. I have no idea why. Originally all the mv's where
- cp's with a similar usage error report. Can anyone explain why?
-
- By the way, the rnyutest alias, doesn't get the usage error report
- for "mv" and does accept parameters properly as in:
- rnyutest comp.unix.questions
- whereas the rnyu and rncol aliases have both problems??
- None of these aliases are recognized froom menu.sh.
-
- I am obviously a neophyte at UNIX.
-
- Thanks in advance for the help.
-
- Henry Manaster
-
- ------------------------The .kshrc file follows----------------
-
- # alias ldir="ls -l $* | more"
- function ldir {
- ls -l $* | more
- }
- # alias adir="ls -al .[a-zA-Z0-9-]* | more"
- function adir {
- ls -al .[a-zA-Z0-9-]* | more
- }
- function aadir {
- ls -al $* |more
- }
- alias elm="elm -z"
- alias postyu="export NNTPSERVER=alsys.edu;post"
- alias postcol="export NNTPSERVER=sol.edu;post"
- function rnalias {
- rn $*
- }
- alias rnyu='export NNTPSERVER=alsys.edu;cd;mv .newsrc.yu .newsrc;mv .oldnewsrc.yu .oldnewsrc;mv .rnlast.yu .rnlast;mv .rnsoft.yu .rnsoft;rnalias;mv newsrc .newsrc.yu;mv .oldnewsrc .oldnewsrc.yu;mv .rnlast .rnlast.yu;mv .rnsoft .rnsoft.yu'
- alias rncol='export NNTPSERVER=sol.edu;cd;mv .newsrc.col .newsrc;mv .oldnewsrc.col .oldnewsrc;mv .rnlast.col .rnlast;mv .rnsoft.col .rnsoft;rnalias;mv .newsrc .newsrc.col;mv .oldnewsrc .oldnewsrc.col;mv .rnlast .rnlast.col;mv .rnsoft .rnsoft.col'
- alias rnyutest='export NNTPSERVER=alsys.edu;cd;cp .newsrc.yu .newsrc;cp .oldnewsrc.yu .oldnewsrc;cp .rnlast.yu .rnlast;cp .rnsoft.yu .rnsoft;rnalias'
-
- ----------------------menu.sh follows here ---------------------
-
- #!//bin/ksh
- # menu.sh - Easy shell for menu to my liking.
- /y/manaster/.kshrc
-
- trap "" 2
- menu="\t\t\t\tMain Menu
- ____________________________________________________________________________
- \n\t\t\t1 - rnyu comp.periphs.scsi comp.sys.ibm.pc.hardware
- \n\t\t\t2 - rnyu sci.crypt comp.compression .comp.compression.research
- \n\t\t\t3 - rnyu comp.text comp.theory.info-retrieval
- \n\t\t\t4 - rnyu news.answers
- \n\t\t\t5 - rnyu
- \n\t\t\t6 - mail
- \n\t\t\t7 - elm -z
- \n\t\t\t\t X - Exit
- ____________________________________________________________________________
- \n\t\t\t\tEnter Selection> _\b"
- while :
- do
- echo "$menu\c"
- read choice overflow
- case $choice in
- 1) cd; rnyu comp.periphs.scsi comp.sys.ibm.pc.hardware;;
- 2) cd; rnyu sci.crypt comp.compression comp.compression.research;;
- 3) cd; rnyu comp.text comp.theory.info-retrieval;;
- 4) cd; rnyu news.answers;;
- 5) cd; rnyu;;
- 6) cd; mail;;
- 7) cd; elm -z;;
- [Xx]*) break;;
- *) echo "Sorry, invalid choice. Please try again."
- sleep 2
- continue
- ;;
- esac
- echo "Finished doing choice #$choice\n\c" ;sleep 2
- done
-
- --
- ***************************************************************************
- Henry Manaster * EMail: manaster@yu1.yu.edu
- Brooklyn, NY *
- *
- Disclaimer: The above is not necessarily MY opinion nor that
- of anyone else :-) ????!
- ****************************************************************************
-
-