aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/scripts/download.sh
diff options
context:
space:
mode:
authorGravatar Ben Boeckel <MathStuf@gmail.com>2011-03-10 20:02:12 -0500
committerGravatar Ben Boeckel <MathStuf@gmail.com>2011-03-10 22:32:30 -0500
commit6cb7be2b071f5e540c33ecc5e21ab22c81434834 (patch)
tree5877f68d32a950f5dc8fecb3ba56218c47f8132b /examples/data/scripts/download.sh
parentdb5213a116da236ff829ee4fa9a14c20867a852b (diff)
Reduce the complexity of the variable assignment
Diffstat (limited to 'examples/data/scripts/download.sh')
-rwxr-xr-xexamples/data/scripts/download.sh4
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"