Skip to content

Commit

Permalink
Replace tac with awk to be more portable
Browse files Browse the repository at this point in the history
"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.
  • Loading branch information
shtayerc committed Oct 14, 2024
1 parent 5ad75a0 commit 9b42d1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions distrobox-enter
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,8 @@ if [ "${unshare_groups:-0}" -eq 1 ]; then
fi

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

0 comments on commit 9b42d1c

Please sign in to comment.