check validity of a Bash command using Bash
by BudiKusasi from LinuxQuestions.org on (#590AT)
How to check validity of a Bash command without executing it, using Bash command, when in a running script ?
e.g. for echo command checking,has been tried this:
Code:#!/usr/bin/bash
set -n 'echo HI' &&echo Y
...the output
Y
Code:#!/usr/bin/bash
set -n 'eco HI' &&echo Y
...the output
Y
won't do the check, what Bash command to solve ?


e.g. for echo command checking,has been tried this:
Code:#!/usr/bin/bash
set -n 'echo HI' &&echo Y
...the output
Y
Code:#!/usr/bin/bash
set -n 'eco HI' &&echo Y
...the output
Y
won't do the check, what Bash command to solve ?