Answering another question, I created the following bash script:
#!/bin/bash files1=( file1.txt file2.txt file3.txt ) files2=( file1_.txt file2_.txt file3_.txt ) cmd="vim -c 'set diffopt=filler,vertical' -c 'edit ${files1[0]}' -c 'diffsplit ${files2[0]}' " echo $cmd for i in {1..2}; do cmd="${cmd} -c 'tabe ${files1[i]}' -c 'diffsplit ${files2[i]}' " done
the problem is that if I try to run
$cmd
I get errors at the end of the script, but if I just use echo $ cmd and then copy and paste on the command line, it works fine.
Any ideas what I'm doing wrong?
Thanks.
source share