Skip to main content
added 248 characters in body
Source Link

BASH, 111111 108 bytes

a=$(cat) curl -s https://xkcd.com/$a/ |grep -oP '(?<=Title text:)([^}}]*)' [ $a = 404 ] && echo "$a not found"

a=$(cat)
curla=#;curl -s https://xkcd.com/$a/ |grep -oP '(?<=Title text:)([^}}]*)'
[';[ $a = 404 ] && echo "$a not found"


To Run:
echo "$number" |change # to number of comic./xkcd Run from command line.sh

Thanks @Ale for the suggestion!

BASH, 111 bytes

a=$(cat)
curl -s https://xkcd.com/$a/ |grep -oP '(?<=Title text:)([^}}]*)'
[ $a = 404 ] && echo "$a not found"


To Run:
echo "$number" |./xkcd.sh

BASH, 111 108 bytes

a=$(cat) curl -s https://xkcd.com/$a/ |grep -oP '(?<=Title text:)([^}}]*)' [ $a = 404 ] && echo "$a not found"

a=#;curl -s https://xkcd.com/$a/ |grep -oP '(?<=Title text:)([^}}]*)';[ $a = 404 ] && echo "$a not found"


To Run:
change # to number of comic. Run from command line.

Thanks @Ale for the suggestion!

Source Link

BASH, 111 bytes

a=$(cat)
curl -s https://xkcd.com/$a/ |grep -oP '(?<=Title text:)([^}}]*)'
[ $a = 404 ] && echo "$a not found"


To Run:
echo "$number" |./xkcd.sh