@@ -118,34 +118,35 @@ while [[ $# -gt 0 ]]; do
118
118
shift ;;
119
119
120
120
* )
121
- if [ " ${execute_mode-} " == ' script' ]; then
122
- addScript " $1 "
123
- else
124
- # script if extension .scala or .sc, or if has scala hashbang line
125
-
126
- # no -f test, issue meaningful error message (file not found)
127
- if [[ " $1 " == * .scala || " $1 " == * .sc ]]; then
128
- setExecuteMode ' script' # execute_script=true
129
-
130
- # -f test needed before we examine the hashbang line
131
- elif [[ (-f " $1 " && ` head -n 1 -- " $1 " | grep ' #!.*scala' ` ) ]]; then
132
- setExecuteMode ' script' # execute_script=true
133
- fi
121
+ # script if extension .scala or .sc, or if has scala hashbang line
122
+ # no -f test, issue meaningful error message (file not found)
123
+ if [[ " $1 " == * .scala || " $1 " == * .sc ]]; then
124
+ setExecuteMode ' script' # execute_script=true
125
+
126
+ # -f test needed before we examine the hashbang line
127
+ elif [[ (-f " $1 " && ` head -n 1 -- " $1 " | grep ' #!.*scala' ` ) ]]; then
128
+ setExecuteMode ' script' # execute_script=true
129
+ fi
134
130
135
- if [ " ${execute_mode-} " == ' script' ]; then
136
- target_script=" $1 "
137
- if [ ! -f $target_script ]; then
138
- # likely a typo or missing script file, quit early
139
- echo " not found: $target_script " 1>&2
140
- scala_exit_status=2
141
- onExit
142
- fi
143
- else
144
- # all unrecognized args appearing prior to a script name
145
- addResidual " $1 "
131
+ if [ " ${execute_mode-} " == ' script' ]; then
132
+ target_script=" $1 "
133
+ shift
134
+ if [ ! -f $target_script ]; then
135
+ # likely a typo or missing script file, quit early
136
+ echo " not found: $target_script " 1>&2
137
+ scala_exit_status=2
138
+ onExit
146
139
fi
140
+ # all are script args
141
+ while [[ $# -gt 0 ]]; do
142
+ addScript " ${1} "
143
+ shift
144
+ done
145
+ else
146
+ # all unrecognized args appearing prior to a script name
147
+ addResidual " $1 "
148
+ shift
147
149
fi
148
- shift
149
150
;;
150
151
151
152
esac
0 commit comments