0

This is how my input looks like:

privatertid=[ "usr-11111", "usr-22222" ]

I am looping thru this treating it as an array and if the the string starts with usr-, I want to do more operations on it.

for i in $privatertid; do
  echo checking $i
  if [[ "$i" == usr-* ]]; then
    echo user:$i
  fi;
done

Control of the program never echoes user:usr-11111 or user:usr-22222.

Am i not comparing the "string starts with usr-" correctly?

codeforester
  • 34,080
  • 14
  • 96
  • 122
Asdfg
  • 10,383
  • 23
  • 89
  • 160

0 Answers0