Skip to content

Commit

Permalink
fix: improve home directory expansion handling in ash shell script
Browse files Browse the repository at this point in the history
Co-Authored-By: Paul Kuruvilla <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and rohitpaulk committed Dec 27, 2024
1 parent 8544192 commit 9973519
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/test_helpers/ash/your_shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ while true; do
if [ "$command" = "echo" ] && echo "$*" | grep -q "'\''.*\\\\\\\\n.*'\''"; then
# Execute echo with preserved quotes
echo "$*"
elif [ "$command" = "cd" ]; then
# Handle home directory expansion for cd
args=$(echo "$*" | sed "s|^~/|$HOME/|;s|^~$|$HOME|")
cd "$args" 2>&1
else
# Try to execute command and handle errors
if ! command -v "$command" >/dev/null 2>&1; then
Expand Down

0 comments on commit 9973519

Please sign in to comment.