0

In the following script

#!/bin/bash
shopt -s globstar
set -e

fwd_slsh='/' space=' ' ampersands='&&' bang='!' opnbrc='[' clsbrc=']' caret='^'

prefix=${bang}${fwd_slsh}${opnbrc}${caret} suffix=${clsbrc}${fwd_slsh}

echo $prefix echo $suffix

the resultant output is as shown below:

!/^
/

The resulting echo output omits the '[' and the ']'.

What is the change required to the above script so that both '[' and ']' are included in the echo outputs? Just wanted to reiterate that I would want to retain the above convention if possible, that is, include both the '[' and ']' as part of the variables as shown above.

My intention is to use the variables prefix and suffix in awk commands, along with other variables input by the user during runtime.

Appreciate your thoughts.

TIA

Vinod

Vinod
  • 165
  • 1
  • 4

0 Answers0