Skip to content

Commit dd467f7

Browse files
authored
Replace tac with awk to be more portable (#1591)
"tac" is GNU coreutils specific command - it is not present in bsd utils. There is also "tail -r", but the parameter is not POSIX compliant.
1 parent 45eef8f commit dd467f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

distrobox-enter

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,8 @@ if [ "${unshare_groups:-0}" -eq 1 ]; then
712712
fi
713713

714714
# Generate the exec command and run it
715-
cmd="$(generate_enter_command | tac)"
716-
# Reverse it with tac so we can reverse loop and prepend the command's arguments
715+
cmd="$(generate_enter_command | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--]}')"
716+
# Reverse it so we can reverse loop and prepend the command's arguments
717717
# to our positional parameters
718718
IFS='
719719
'

0 commit comments

Comments
 (0)