0

i need some help here as i couldn't figure it out the errors.

read input    
echo -e "$input" | cut -c4-    
cd "$input" | cut -c4-

So I enter cd test, echo output is correct which is test.

I would like to change directory but it gives cd cd test.

Any help is appreciated.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Wai Chin
  • 107
  • 1
  • 2
  • 8

1 Answers1

0

What you want should be:

cd $(echo -e "$input" | cut -c4-)

Which can be done as well like this (see bash "here strings")

cd $(cut -c4- <<<$input)
Stephane Rouberol
  • 4,286
  • 19
  • 18