0

I wrote the following shell script

for i in mylist
do
cd $i
old = $(svn info | grep URL:)
echo old
done

but I get the following error message:

line 5: old: command not found

Hoe can I allocate the value obtained from (svn info | grep URL:) in a parameter. I tried the following echo$(svn info | grep URL:), that works but the allocation to old and then print the variable old dose not work. How can I solve the problem?

maniA
  • 1,437
  • 2
  • 21
  • 42

1 Answers1

0

You need to remove the spaces:

old=$(svn info | grep URL:)

Bash is sensitive to spaces in assignment.

See also here for more details.

Community
  • 1
  • 1
Julian
  • 2,837
  • 17
  • 15
  • Thanks a lot indeed but I can accept the answer in 10 min :) – maniA Jan 11 '16 at 12:35
  • Julian, do you know why dose this (DIRS=`ls -l $MYDIR | egrep '^d' | awk '{print $9}'` for dir in $DIRS do cd $dir old=$(svn info | grep URL:) echo old done) does not work? – maniA Jan 11 '16 at 12:47
  • No, I think you need to post a new question including output if you're unable to solve it. Thanks for accepting my answer. – Julian Jan 11 '16 at 14:13
  • thanks a lot Julian I solved it :) – maniA Jan 11 '16 at 14:14