0

The commands true and false do nothing but return 0 and 1 respectively. I am looking for a similar command to do nothing but return an arbitrary exit code for testing purposes.

With that, I could

ssh remote return 27; echo $?

Which does not work because

bash: line 0: return: can only `return' from a function or sourced script
Tilman Vogel
  • 159
  • 4

1 Answers1

4

Actually, just as I write out the question, the obvious solution came to my mind but maybe someone else can use it one day:

ssh remote exit 27; echo "$?"

works as desired...!

Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501
Tilman Vogel
  • 159
  • 4