what's wrong with my shell
Nov 15, 2014 at 6:46am UTC
hey, guys~
I'm kinda new to shell programming on linux. my code is as follows:
1 2 3 4
#!/bin/bash
a = 111
echo $a
read -p "..."
and the execution result is:
a: command not found
It's a simple assignment to variable a. i made reference to some websites, it seams there is no mistake, so what's wrong?
Nov 15, 2014 at 9:33am UTC
Remove the spaces around =.
Nov 15, 2014 at 10:20am UTC
Thanks your very much@Peter87.
Another more question. are there some tools can help you to debug shell code? like seting breakpoints, watching values etc?
Nov 28, 2014 at 3:12pm UTC
Include f.e.
1 2 3 4 5
# Code not being debugged
set -vx
# Your code to be debugged
set +vx
# Code not being debugged
The debug output wil be written to stderr. So you may want to redirect stderr to a text file to not confuse your programs IO.
Topic archived. No new replies allowed.