diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2011-03-10 20:02:12 -0500 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2011-03-10 22:32:30 -0500 |
commit | 6cb7be2b071f5e540c33ecc5e21ab22c81434834 (patch) | |
tree | 5877f68d32a950f5dc8fecb3ba56218c47f8132b /examples/data/scripts/download.sh | |
parent | db5213a116da236ff829ee4fa9a14c20867a852b (diff) |
Reduce the complexity of the variable assignment
Diffstat (limited to 'examples/data/scripts/download.sh')
-rwxr-xr-x | examples/data/scripts/download.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/data/scripts/download.sh b/examples/data/scripts/download.sh index 561ac31..6bcd9d1 100755 --- a/examples/data/scripts/download.sh +++ b/examples/data/scripts/download.sh @@ -11,8 +11,10 @@ # the URL that is being downloaded uri="$1" +safe_uri="$(echo "$uri" | sed -e 's/\W/-/g')" + # a filename suggested by the server or based on the URL -suggested_filename="${2:-$(echo "$uri" | sed -e 's/\W/-/g')}" +suggested_filename="${2:-$safe_uri}" # the mimetype of the file being downloaded content_type="$3" |