Permalink
Browse files

verify if the user entered something in echo

  • Loading branch information...
1 parent 703a05f commit 7cbdeecb4f5bd93ee9c0a962578171aca7dbbad5 @Geal committed Feb 22, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 echo/echo.sh
View
7 echo/echo.sh
@@ -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

0 comments on commit 7cbdeec

Please sign in to comment.