-4

I tried:

who & pwd and it output the result of pwd output: /root.

May I know if I am right?

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
gene
  • 11
  • There's no motivation for this question (and no question in the Question body); why do you need the output of two commands with one command? You fake it by writing a script that executes those two commands, then call the "one" script, but this sounds like it's a homework assignment to teach you about command-lines. Perhaps you could lay out what you've learned and why you think that we're the right people to tell you if your homework is correct. – Jeff Schaller Nov 15 '18 at 15:03

1 Answers1

2

The & operator has nothing to do with executing two commands, see this question.

In order to execute two distinct commands on the same line, use the appropriate separator ;:

who; pwd

Erwan
  • 219