@@ -71,6 +71,29 @@ if [[ "$ONEPROFILE" = "false" ]]; then
71
71
72
72
else
73
73
74
+ # Check OS for some supported platforms
75
+ OS=" ` uname` "
76
+ case $OS in
77
+ ' Linux' )
78
+ OS=' Linux'
79
+ ;;
80
+ ' Darwin' )
81
+ OS=' macOS'
82
+ ;;
83
+ * )
84
+ OS=' unknown'
85
+ echo
86
+ echo " ** NOTE: THIS SCRIPT HAS NOT BEEN TESTED ON YOUR CURRENT PLATFORM."
87
+ echo
88
+ ;;
89
+ esac
90
+
91
+ # make sure ~/.aws/credentials has a linefeed in the end
92
+ c=$( tail -c 1 " $CREDFILE " )
93
+ if [ " $c " != " " ]; then
94
+ echo " " >> " $CREDFILE "
95
+ fi
96
+
74
97
# # PREREQS PASSED; PROCEED..
75
98
76
99
declare -a cred_profiles
@@ -385,10 +408,29 @@ else
385
408
echo "Region is set to: $get_region "
386
409
echo "Output format is set to: $get_output "
387
410
echo
388
- echo "Execute the following in Terminal to activate this profile:"
389
- echo "export AWS_PROFILE=${final_selection} "
390
- echo -n "export AWS_PROFILE=${final_selection} " | pbcopy
391
- echo "(the activation command is now on your clipboard -- just paste in Terminal, and press [ENTER])"
411
+ if [ "$OS " = "macOS" ]; then
412
+ echo "Execute the following in Terminal to activate this profile:"
413
+ echo
414
+ echo "export AWS_PROFILE=${final_selection} "
415
+ echo
416
+ echo -n "export AWS_PROFILE=${final_selection} " | pbcopy
417
+ echo "(the activation command is now on your clipboard -- just paste in Terminal, and press [ENTER])"
418
+ elif [ "$OS " = "Linux" ]; then
419
+ echo "Execute the following on the command line to activate this profile:"
420
+ echo
421
+ echo "export AWS_PROFILE=${final_selection} "
422
+ echo
423
+ if exists xclip ; then
424
+ echo -n "export AWS_PROFILE=${final_selection} " | xclip -i
425
+ echo "(xclip found; the activation command is now on your X PRIMARY clipboard -- just paste on the command line, and press [ENTER])"
426
+ else
427
+ echo "If you're using an X GUI on Linux, install 'xclip' to have the activation command copied to the clipboard automatically."
428
+ fi
429
+ else
430
+ echo "Execute the following on the command line to activate this profile:"
431
+ echo
432
+ echo "export AWS_PROFILE=${final_selection} "
433
+ fi
392
434
echo
393
435
394
436
fi
0 commit comments