summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2015-05-02 18:45:11 +0100
committerLuke Bratch <luke@bratch.co.uk>2015-05-02 18:45:11 +0100
commite0c0eec421954badbe5c9d67868b9fe1f368d24a (patch)
treeba32ed5aad7f768c4149c71cf44079661e05c937
parent00445de1151722f8b67541e8bef0fcf31b2960ba (diff)
Put curl's arguments into a variable
-rwxr-xr-xtitle.bash4
1 files changed, 3 insertions, 1 deletions
diff --git a/title.bash b/title.bash
index d1754d9..9bed0c5 100755
--- a/title.bash
+++ b/title.bash
@@ -13,6 +13,8 @@
: update user agent string
# v0.8.1: change name in version string to "blatitle"
+OPTS='--location --insecure --silent --max-filesize 1048576 --max-time 10 -A "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0"'
+
read url
if [ "$url" == "-h" ] || [ "$url" == "--help" ]
@@ -22,5 +24,5 @@ elif [ "$url" == "-v" ] || [ "$url" == "--version" ]
then
echo "blatitle version 0.8.1"
else
- curl --location --insecure --silent --max-filesize 1048576 --max-time 10 -A "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0" "$url" | sed -n -e 'H;${x;s!.*<head[^>]*>\(.*\)</head>.*!\1!I;tnext};b;:next;s!.*<title>\(.*\)</title>.*!\1!pI' | sed ':a;N;$!ba;s/\n//g' | sed -e 's/^[ \t]*//'
+ curl $OPTS "$url" | sed -n -e 'H;${x;s!.*<head[^>]*>\(.*\)</head>.*!\1!I;tnext};b;:next;s!.*<title>\(.*\)</title>.*!\1!pI' | sed ':a;N;$!ba;s/\n//g' | sed -e 's/^[ \t]*//'
fi