Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

verify if the user entered something in echo

  • Loading branch information...
commit 7cbdeecb4f5bd93ee9c0a962578171aca7dbbad5 1 parent 703a05f
Geoffroy Couprie authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 echo/echo.sh
7 echo/echo.sh
View
@@ -1,3 +1,8 @@
#!/bin/sh
-echo "{ \"version\": 1, \"title\": \"Echo\", \"type\":\"commands\", \"values\" : [ { \"name\" : \"Echo\", \"value\" : \"$1\", \"command\" : \"\"} ] }";
+if [ "$#" -ne 1 ]
+then
+ echo '{ "version": 1, "title": "Echo", "type":"status", "status":"error", "message":"Please enter something" }';
+else
+ echo "{ \"version\": 1, \"title\": \"Echo\", \"type\":\"commands\", \"values\" : [ { \"name\" : \"Echo\", \"value\" : \"$1\", \"command\" : \"\"} ] }";
+fi
Please sign in to comment.
Something went wrong with that request. Please try again.