Article 5PZ76 if...else...statement

if...else...statement

by
CyberIT
from LinuxQuestions.org on (#5PZ76)
Im stuck on this if...else...statement.

Code:rm1=$1
rm2=$2
rec1=$2
rec1=$3

input_validation ()
{
if [ rm1=$1 ] && [ rm2=$2 ]; then
if [ $# -ne 2 ]; then
usage
fi

elif [ rm1=$1 ] && [ rm2=$2 ] && [ rec1=$3 ]; then
if [ $# -ne 3 ]; then
usage2
fi

elif [ rm1=$1 ] && [ rec1=$2 ]; then
if [ $# -ne 2 ]; then
usage1
fi

fiCode:if [ "$rec1" == "a" ]; then
...command
...command

elif [ "$rec1" == "b" ]; then
...command
...command

else
...command
...command
fiIt fails on the bold if statement ... I dont know a way around.

First IF statement needs inputs 1 and 2.
Second IF statement needs inputs 1 and 2 and 3.
Third IF statement needs inputs 1 and 3 but not 2.

Please help. Thank you!latest?d=yIl2AUoC8zA latest?i=xy5U5jAiypE:7rp1xkkhWdY:F7zBnMy latest?i=xy5U5jAiypE:7rp1xkkhWdY:V_sGLiP latest?d=qj6IDK7rITs latest?i=xy5U5jAiypE:7rp1xkkhWdY:gIN9vFwxy5U5jAiypE
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments