I am basing my question on the thread here: How can I run a specific line as a command in a text file?
How do I run a set of lines from the the text file?
Here's what I have tried so far:
Input file:
1 #!/usr/bin/csh -v
2
3 date
4
5 echo "abc"
6
7 set cell="bananas"
8
9 set cmd = "echo apples \
10 oranges \
11 graped $cell"
12
13 echo $cmd
14
sed -n '5,13 p' /tmp/1 | sh
gives:
abc
(blank line)
Why doesn't this execute the rest of the lines? Or as I suspect, is it running it but not giving any output since these commands are run in a new? sh(ell) everytime and not in a single shell session?
Thanks!
cshas a scripting language (it is fine as a shell) is a very bad idea.