Skip to content

Commit a97140a

Browse files
committed
Don't clobber an existing .cshrc
1 parent 5e5ed24 commit a97140a

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

.github/workflows/scripts/test_init_scripts.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ for shell in ${SHELLS[@]}; do
2929
echo RUNNING TESTS FOR SHELL: $shell
3030
echo = | awk 'NF += (OFS = $_) + 100'
3131
if [[ ! " ${TEST_SHELLS[*]} " =~ [[:space:]]${shell}[[:space:]] ]]; then
32-
### EXCEPTION FOR CSH ###
3332
echo -e "\033[33mWe don't now how to test the shell '$shell', PRs are Welcome.\033[0m"
3433
else
34+
if [ "$shell" = "csh" ]; then
35+
# make sure our .cshrc is empty before we begin as we will clobber it
36+
[ -f "~/.cshrc" ] && mv "~/.cshrc" "~/.cshrc_orig"
37+
fi
38+
3539
# TEST 1: Source Script and check Module Output
3640
expected="Module for EESSI/$EESSI_VERSION loaded successfully"
3741
assert "$shell -c 'source init/lmod/$shell' 2>&1 " "${expected}"
@@ -105,6 +109,12 @@ for shell in ${SHELLS[@]}; do
105109

106110
# End Test Suite
107111
assert_end "source_eessi_$shell"
112+
113+
if [ "$shell" = "csh" ]; then
114+
# Restore our .cshrc
115+
[ -f "~/.cshrc_orig" ] && mv "~/.cshrc_orig" "~/.cshrc"
116+
fi
117+
108118
fi
109119
done
110120

0 commit comments

Comments
 (0)