Is there a way to run some code in a C-shell script by different shell, like bash?
I have that situation.
I have prepared and perfectly workable bash-skript that now I have to execute under C-shell script, divide it on steps and without creating a new files (with the bash-code parts.)
For example:
> cat c.sh
#!/bin/csh -f
echo " -- starting $0 --"
echo " .. before executing bash-code : "
/bin/bash/ -e <<END
pair=123-456
aRID=${pair%-*}
iRID=${pair#*-}
echo " aRID=$aRID; iRID=$iRID "
END
echo " -- exiting the $0 -- "
> ll c.sh
-rwxrwxrwx 1 abc1929 grsome 218 Feb 4 17:10 c.sh*
> c.sh
-- starting ./c.sh --
.. before executing bash-code :
pair: Undefined variable
>
Even with so simple statement it is already problems.
I need to execute much more advance and complicated processing!
I guess, the C-shell checking the syntax during the entering bash-code line in order to catch the 'END' line.
Maybe it is possible to disable it (the C-shell checking) and enable it after?
The option to have the code in single quotes is not usefull, too!
By that I would need to escape much: that will hightm!
Rewrite the bash script in c-shel - havy and long task!
I see only one option: brake the bash script on bansh of small files and process communication between them through env-variable or temporary files.
Disgusting solution!
Is there any other way?
Thank you!