user3449212
user3449212

Reputation:

Executing two commands together in command line

I followed previous threads:

I want to execute shell file and write into text parallel. Content should be written first in text file and the shell file should be executed.

# input.txt < "I love cat, she is nice" && ./test.sh
bash: I love cat, she is nice: No such file or directory

Another try:

# ./test.sh && input.txt < "I love cat, she is nice"
batch processes ..
bash: I love cat, she is nice: No such file or directory

What is the correct way?

Upvotes: 0

Views: 57

Answers (3)

rnso
rnso

Reputation: 24535

Why not following?

echo "I love cat, she is nice" > input.txt; ./test.sh

Upvotes: 0

Mark Setchell
Mark Setchell

Reputation: 207465

I think you mean this - you want a script to create a script and then run it:

echo "echo hello" > go.sh && chmod +x go.sh && ./go.sh
hello

Upvotes: 0

wRAR
wRAR

Reputation: 25693

echo "I love cat, she is nice" > input.txt && ./test.sh

Upvotes: 2

Related Questions