Rev

rev

Step-in replacement for 'rev' on systems that lack it. Reverses the characters in each line of a file, a string argument, or stdin. Cannot accept both piped input and a positional argument simultaneously.

Arguments

  • $1 (string): Optional: file path or string to reverse; reads stdin if omitted

Exit codes

  • 0: Success
  • 1: Both piped input and a positional argument were provided

Output on stdout

  • Each input line with its characters in reverse order