unix - Why am I getting a "No Match" error in csh script with standard input and output? -


i'm trying feel unix can write short program in unix csh takes stdin , returns stdout. wrote following code:

echo "test"     echo -n "input: "     set test = "$<"     echo $test 

however keep getting error can't quite figure out when type in characters. example,

run 1: no question mark. can see, runs want to.

edoras ~/as4[199]% ./scriptp1         test         input: www.google.com/search         www.google.com/search 

run 2: question mark. suddenly, there's "no match" error.

 edoras ~/as4[201]% ./scriptp1     test     input: https://www.google.com/search?criteria     echo: no match. 

so error , how go fixing it? because actual program have write have able read special characters , print out ascii codes.

from tcsh manual page:

unless enclosed in '"' or given ':q' modifier results of variable substitution may command , filename substituted.

since variable not quoted, shell attempts filename substitution, fails because don't have file matching search?citeria in subdirectory named www.google.com in subdirectory named https: in current directory. "no match" means filename substitution failed. same manual page:

it error glob-pattern containing '*', '?', '[' or '~', or without '^', not match files.

the technical answer ends here. rest purely opinion-based.

please note unless have specific reasons considered preferable write scripts in posix-compatible shell, because csh-compatible shells not available default. think beginner should first learn write scripts in posix-compatible shell , afterwards, if needed, consider csh-compatible shells.


Comments