Article 590AT check validity of a Bash command using Bash

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 ?latest?d=yIl2AUoC8zA latest?i=AkgAYMTASrY:UnBbD7Wwtmw:F7zBnMy latest?i=AkgAYMTASrY:UnBbD7Wwtmw:V_sGLiP latest?d=qj6IDK7rITs latest?i=AkgAYMTASrY:UnBbD7Wwtmw:gIN9vFwAkgAYMTASrY
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments