Here's my problem:
I have 4 scripts to generate diverse files. I have a source file i pass as an argument to generate the other output files. The 4 scripts are thought to be run consecutively. They have code like this:
while read line; do
if echo "${line: -3}" | grep -q ','
then
if echo "${line:0:4}" | grep -q 'int'
then ...
Running them separately give me the right outputs. Calling them from a main script performs wrong, with some error messages like:
./FirstScript.sh: 35: ./FirstScript.sh: Bad substitution
Referring i.e. to the line above:
if echo "${line: -3}" | grep -q ','
My main Script to call the others is:
#!/bin/bash
sh ./FirstScript.sh $1
sh ./SecondScript.sh
sh ./ThirdScript.sh $1
All Scripts have been set to $chmod 755 *.sh