linux - Declaring User Defined Variable in Shell Scripting (csh shell) -
i trying learn shell scripting , trying create user defined variable within script, first
:
howdy="hello $user !" echo $howdy
however, when execute script (./first
) this:
howdy=hello aaron!: command not found. howdy: undefined variable.
what doing wrong?
you have 2 errors in code:
- you using sh syntax instead of csh 1 set variable
- you not escaping "!" character (history substitution)
try this:
#!/bin/csh set howdy="hello $user \!" echo $howdy
Comments
Post a Comment