• 86 Posts
  • 571 Comments
Joined 1 year ago
cake
Cake day: June 13th, 2023

help-circle

  • Your problem is most likely escaping. $1 has a meaning in regex and in shell. You want the former and the single quotes achieve this.

    In your second example, with alias, probably the shell interpreting this replaces $1 with whatever the first arg in the shell environment is, probably the empty string.

    Not sure what the problem with the shell script is. Anyway try escaping the $ as $ and \ as \.

    You can see where you are wrong if you replace prename with echo for debugging. Or in a shell script do

    set -ex