1

I am using SSH; In a folder I have the next files:

-rwxrwxr-x 1 german german   48 Apr 29 10:45 prueba.txt
-rwxrwxr-x 1 german german   23 Apr 29 10:43 script1.sh
-rwxrwxr-x 1 german german   23 Apr 29 10:45 script2.sh

cat script1.sh
echo "Test 1: $(date)"

cat script2.sh
echo "Test 2: $(date)"

cat prueba.txt
bash /home/german/script1.sh
bash /home/german/script2.sh

but when …

`cat prueba.txt`

only execute the first line “script1.sh”

Test 1: Wed Apr 29 10:48:48 COT 2015

How can I execute more than one line in a txt file?

4
  • bash /home/german/prueba.txt
    – Costas
    Commented Apr 29, 2015 at 16:08
  • @Costas the same result.
    – Goerman
    Commented Apr 29, 2015 at 16:18
  • cat /home/german/prueba.txt | bash
    – Costas
    Commented Apr 29, 2015 at 16:21
  • @costas sorry, I made a mistake, the two commands work fine, thanks.
    – Goerman
    Commented Apr 29, 2015 at 16:39

1 Answer 1

1

@Costas - good answer!

And since they're sh scripts,

sh /home/german/prueba.txt

will work, as well.

And, BTW, this was supposed to be a comment (isn't that what Add Comment is supposed to do?)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .