diff options
author | Steven <steven.vasilogianis@gmail.com> | 2021-11-11 13:28:37 -0500 |
---|---|---|
committer | Steven <steven.vasilogianis@gmail.com> | 2021-11-11 13:28:37 -0500 |
commit | 48f39fd5a231b6f8481b153107daca3e48d3ee64 (patch) | |
tree | a162fc57fa1a9368e3efab62557b9d724e4426e0 | |
parent | 81801ba6c7f114f4a09d2775cb8e0e1067015675 (diff) |
don't strip values twice
-rwxr-xr-x | shopenscad.sh | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/shopenscad.sh b/shopenscad.sh index ddb320d..eba5e81 100755 --- a/shopenscad.sh +++ b/shopenscad.sh | |||
@@ -23,7 +23,7 @@ Usage: $0 [-h] [-n] [-p] [-i] [-o OUTPUT-FILENAME] INPUT.scad | |||
23 | -p, --print-vars print variables parsed from INPUT.scad | 23 | -p, --print-vars print variables parsed from INPUT.scad |
24 | -i, --interactive show output command and query for execution | 24 | -i, --interactive show output command and query for execution |
25 | -n, --no-act show output command, do not execute | 25 | -n, --no-act show output command, do not execute |
26 | -s, --shell-skel initialize a skeleton shell script | 26 | -s, --shell-skel output a skeleton shell script for generating models |
27 | -o, --output-filename Specify an output filename. The following variables are | 27 | -o, --output-filename Specify an output filename. The following variables are |
28 | available to you: | 28 | available to you: |
29 | 29 | ||
@@ -137,10 +137,6 @@ val_to_filename () { | |||
137 | echo "$1" |sed -r 's/"//g' |sed -r 's/ /_/g' | 137 | echo "$1" |sed -r 's/"//g' |sed -r 's/ /_/g' |
138 | } | 138 | } |
139 | 139 | ||
140 | strip_last_char () { | ||
141 | echo "$1" |sed -r 's/.$//' | ||
142 | } | ||
143 | |||
144 | strip_after_hidden () { | 140 | strip_after_hidden () { |
145 | sed -n '/\/\* \[Hidden\] \*\//q;p' "$1" | 141 | sed -n '/\/\* \[Hidden\] \*\//q;p' "$1" |
146 | } | 142 | } |
@@ -207,7 +203,7 @@ EOF | |||
207 | ALL=$(strip_trailing "$var_sep" "$ALL") | 203 | ALL=$(strip_trailing "$var_sep" "$ALL") |
208 | VALUES=$(strip_trailing "$val_sep" "$VALUES") | 204 | VALUES=$(strip_trailing "$val_sep" "$VALUES") |
209 | 205 | ||
210 | default_output_filename="$(strip_trailing "-" "${VALUES}").stl" | 206 | default_output_filename="${VALUES}.stl" |
211 | output_filename="$default_output_filename" | 207 | output_filename="$default_output_filename" |
212 | if [ "$USER_OUTPUT_FILENAME" ]; then | 208 | if [ "$USER_OUTPUT_FILENAME" ]; then |
213 | output_filename=$(echo $(eval "echo $USER_OUTPUT_FILENAME")) | 209 | output_filename=$(echo $(eval "echo $USER_OUTPUT_FILENAME")) |