Sunday, April 8, 2018

bash - Syntax error with regex in command alias

I have created an alias in UNIX in which regex is creating problem.
My intention is to use alias as _enable -input, the parameter should be passed with "-".
Not getting where the problem is.




alias is



alias _enable="function _enable() { [[ $1 =~ ^- ]] || { echo \"Use hyphen (-) before nodes.\"; return 1; } ; [[ $# = 1 ]] && { NODE=`echo ${1##*-}`; } || { NODE=\"\"; } ; $HOME/bin/command --command=enable --node=$NODE; }; _enable $1;"


The actual output is:



SS-04:~ # _enable 1
-bash: conditional binary operator expected
-bash: syntax error near `^-'

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...