0

I want to run multiple commands on command line in linux. Here's the example:

abc.txt: hello

$ test 'cat abc.txt'

Here test is a command which runs agains the value of abc.txt and abc.txt is the file which have some value.

How can i print the value from the file and run the test command ?

1
  • Beware of using "test" as the name of your command. It is already a command and, depending on your PATH, it may be executed before your local "test", thus rendering unexpected results. Run this command to see which "test" your shell will actually run: "which test". To run your local "test", you may need to proceed it with a dot-slash, to force the shell to look in the current directory first: "./test " Commented Aug 13, 2014 at 15:22

1 Answer 1

1

This runs cat abc.txt, placing the contents of that file the command line where they are used as arguments to the command test:

test "$(cat abc.txt)"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.