Skip to content

Commit

Permalink
Make /etc/profile.d/path.sh shell independent
Browse files Browse the repository at this point in the history
Or at least add support for `/bin/sh -> dash` on ubuntu as well. This fixes
aws/aws-parallelcluster#5760.
  • Loading branch information
stephenmsachs committed Oct 17, 2023
1 parent 4cc0bdb commit e5e8dd8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cookbooks/aws-parallelcluster-shared/templates/profile/path.sh.erb
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/sh

PATH_REQUIRED_DIRECTORIES=(<%= @path_required_directories.join(' ') %>)
PATH_REQUIRED_DIRECTORIES="<%= @path_required_directories.join(' ') %>"

for directory in "${PATH_REQUIRED_DIRECTORIES[@]}"; do
[[ ":$PATH:" == *":$directory:"* ]] || PATH="${PATH:+"$PATH:"}$directory"
for directory in ${PATH_REQUIRED_DIRECTORIES}; do
[ ":$PATH:" = *":$directory:"* ] || PATH="${PATH:+"$PATH:"}$directory"
done

export PATH

0 comments on commit e5e8dd8

Please sign in to comment.