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:

  1. you using sh syntax instead of csh 1 set variable
  2. you not escaping "!" character (history substitution)

try this:

#!/bin/csh  set howdy="hello $user \!" echo $howdy 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -