andy@cbmvax.UUCP (04/03/87)
Here's a couple of semi-useful scripts I did because I like playing with shell scripts. Both are for use under V1.2. The first uses a combination of the date command and the setdate command to act as a touch command. The second shows a way to get a kind of menu selection in a shell script. The names are important. touch must be called touch, because of the Execute statement within the script, and menu must be called menu for the same reason. (and both naturally should live in the S directory.) Both scripts show some useful tricks you can use in other scripts. In particular, touch shown how to parse parameters in a script file, while menu shows a (possibly) unrecognized ability of AmigaDos commands (use of the ?) andy finkel ----------------------------------------------------- S:touch -------------------CUT HERE--------------------------- .KEY a,b,c,d .BRA ( .KET ) failat 30 if (b$"") EQ "" SKIP NEXT endif ; setdate (a) (c) (d) quit ; lab NEXT if exists (a) date > ram:qwe execute <ram:qwe >NIL: touch (a) ? endif echo "(a) not found" -------------------CUT HERE--------------------------- ------------------------------------------------------ S:menu -------------------CUT HERE--------------------------- .BRA ( .KET ) failat 100 echo "*Ec*E[1mCLI Script Menu Example*E[0m*N" echo "would you like a list, a directory, cd, or quit ?" skip <* >NIL: ? ; lab list lab l list skip done ; lab dir lab d dir skip done ; lab quit lab q quit ; lab cd cd <* ? skip done ; lab echo "Try again" ; lab done wait 1 execute menu -------------------CUT HERE--------------------------- -- andy finkel {ihnp4|seismo|allegra}!cbmvax!andy Commodore/Amiga /or/ pyramid!amiga!andy } "Do not meddle with the affairs of wizards, for it makes them soggy and hard to light." Any expressed opinions are mine; but feel free to share. I disclaim all responsibilities, all shapes, all sizes, all colors.