Gary_D_Walborn@cup.portal.com (07/04/89)
I have recently encountered some problems with AShell and grep. I think that these problems may be 'features' of AShell. First, it seems that the scanner has been written to allow ')' and '(' and other strange characters in environment variables. This may be the desired function, but raises havoc with some other commands after command line expansion. In particular, I have been attempting to use 'beval' with a command line variable 'foo'. 1>foo=4 1>echo $foo 4 1>echo $foo+3 1>echo "$foo+3" Echo: Unmatched quotes It seems that it would be wise to limit environment variables to A-Z,0-9 and (possibly) underscore so that "$foo+3" would expand to "4+3". I have also encountered a problem with the 'expansion' of *. For example: 1>echo "^.*$" ^.$ What happened to the "*"? This is a real problem when using grep as the asterisk is frequently used in regular expressions. In what may be a related problem, I noticed the following peculiarity: 1>grep snake test File test: snake 1>grep "snake" test 1> Ashell brings a whole new level of functionality to the CLI environment but the execution seems to be somewhat flawed. Any comment on the observed peculiarities would be appreciated. Gary D. Walborn
ecphssrw@roger.csun.edu (Stephen Walton) (07/07/89)
In article <20107@cup.portal.com>, Gary_D_Walborn@cup writes: > >1>foo=4 >1>echo $foo >4 Fine so far. >1>echo $foo+3 Here there is no environment variable named foo+3 so you get no echo. >1>echo "$foo+3" >Echo: Unmatched quotes Hmm...don't know about this one. >[He would like] "$foo+3" would expand to "4+3". It does if you precede and follow the + sign with spaces. Space is the delimiter in AShell just as in CLI; neither knows a + sign from an alpha. >1>echo "^.*$" >^.$ Again, AShell, like the CLI and the CBM Shell, uses * as an escape, so that if you want a * in an argument you have to double it: 1>grep "^.**$" file 1>grep "*"" file The second example will look for a single " in file. You may want to (re-)read both the CBM and ARP docs on the respective shells. There is a way to make AShell use \ instead of * as the escape but I don't know what it is offhand; it is in the docs. Steve Walton
Gary_D_Walborn@cup.portal.com (07/09/89)
Thanks for the input.... C. Heath helped by referencing the appropriate documentation for the escape symbol. I still think that '+' should not be acceptable as part of an environment variable (WARNING: This is only my personal opinion and should not be construed as a gripe or as gospel). I am still in the dark about the grep problem with "snake". I have a text file with the word 'snake' on itself on a line. The command: 1>grep snake file1 returns: File file1: snake But the command: grep "snake" file1 returns NOTHING! What is going on here? I thought that the shell would strip the quotes and supply snake as the argument to grep. I will give this a try on UTS and see what happens! Thanks for the input! Gary D. Walborn Gary_Walborn@cup.portal.com