Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
#!/bin/bash

input=""

echo "Does a wall needs to be sent?"
read input

if [ $input="yes" ]; then
   echo "Sending message to all users"
   echo ""
else if [ $input="no"]; then
    exit
    fi
fi
echo "Is this a reboot or shutdown?"
      read input
if [ $input="reboot" ]; then
   reboot
elif [ $input="shutdown" ]; then
else
echo ""
echo "Goodbye"
share|improve this question

closed as off-topic by jasonwryan, slm Jul 12 '14 at 3:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – jasonwryan, slm
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Among other things, you need spaces around the assignments, eg., [ $input = "yes" ]... – jasonwryan Jul 12 '14 at 3:31
    
elif dude, elif. else is for the final catch-all. – RobotHumans Jul 12 '14 at 3:31

That script has a bunch of issues. Here's a cleaned up version:

#!/usr/bin/env bash

input=""

echo "Does a wall needs to be sent?"
read input

if [ "$input" = "yes" ]; then
    echo "Sending message to all users\n"
elif [ "$input" = "no" ]; then
    exit
fi

echo "Is this a reboot or shutdown?"
read input

if [ "$input" = "reboot" ]; then
    reboot
elif [ "$input" = "shutdown" ]; then
    shutdown -h now
fi

echo "\nGoodbye"

Honestly though, this is still really poorly done. I would recommend using case statements parsing arguments instead of reading input.

share|improve this answer
1  
Big Help ! Thanks – Yan Jul 12 '14 at 4:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.