bash -n scriptname
Perhaps an obvious caveat: this validates syntax but won’t check if your bash script tries to execute a command that isn’t in your path, like ech hello
instead of echo hello
.
More Related Contents:
- What are the rules for valid identifiers (e.g. functions, vars, etc) in Bash?
- grep lines that contain 1 character followed by another character
- When should I wrap quotes around a shell variable?
- How to convert DOS/Windows newline (CRLF) to Unix newline (LF) in a Bash script
- How do I write standard error to a file while using “tee” with a pipe?
- What’s the magic of “-” (a dash) in command-line parameters?
- How to get overall CPU usage (e.g. 57%) on Linux [closed]
- How to merge two files using AWK? [duplicate]
- What does $@ mean in a shell script?
- Forcing bash to expand variables in a string loaded from a file
- What does `set -x` do?
- How do you find the original user through multiple sudo and su commands?
- Does “argument list too long” restriction apply to shell builtins?
- Given two directory trees, how can I find out which files differ by content? [closed]
- How to concatenate multiple lines of output to one line?
- How can I remove the last character of a file in unix?
- Managing log files created by cron jobs
- How to run a shell script on a Unix console or Mac terminal?
- How to check if a file is empty in Bash?
- Using the passwd command from within a shell script
- How to sort strings that contain a common prefix and suffix numerically from Bash?
- Should PATH contain directories or full paths to binaries?
- Execute a command without keeping it in history [closed]
- linux: kill background task
- Why can’t I use Unix Nohup with Bash For-loop?
- Linux/Unix command to determine if process is running?
- Running shell script in parallel
- Difference between shell and environment variables
- Bash script to remove ‘x’ amount of characters the end of multiple filenames in a directory?
- How do you run a script on login in *nix?