I don't know how to use variables for further executing in a script.
I tried the following:
#!/bin/bash NUM = 0 echo Number $NUM > text.txt
but I get the following error:
num.sh: 3: num.sh: NUM: not found
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
There must not be any whitespace around
= in variable declaration in shell.
Remove the whitespaces:
Also if you don't have any good reason, don't use all uppercases for a user defined shell variable name as there is chance that this could conflict with any environment variable.