I am trying to compare two strings but i am having problem [duplicate]
This question already has an answer here:
Bash: command not found
2 answers
read -p 'username : ' usr_value
read -sp 'password : ' psw_value
echo
a=fghj
if["usr_value" = "$a"] #I am having problem in this line
then
echo "you have correct username"
else
echo "you have incorrect username"
if
bash
marked as duplicate by Sergiy Kolodyazhnyy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 30 '18 at 8:40
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Bash: command not found
2 answers
read -p 'username : ' usr_value
read -sp 'password : ' psw_value
echo
a=fghj
if["usr_value" = "$a"] #I am having problem in this line
then
echo "you have correct username"
else
echo "you have incorrect username"
if
bash
marked as duplicate by Sergiy Kolodyazhnyy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 30 '18 at 8:40
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Only use Kali tags while referring to problems specific to Kali. Moreover, Kali is off-topic here.
– Kulfy
Dec 30 '18 at 8:26
add a comment |
This question already has an answer here:
Bash: command not found
2 answers
read -p 'username : ' usr_value
read -sp 'password : ' psw_value
echo
a=fghj
if["usr_value" = "$a"] #I am having problem in this line
then
echo "you have correct username"
else
echo "you have incorrect username"
if
bash
This question already has an answer here:
Bash: command not found
2 answers
read -p 'username : ' usr_value
read -sp 'password : ' psw_value
echo
a=fghj
if["usr_value" = "$a"] #I am having problem in this line
then
echo "you have correct username"
else
echo "you have incorrect username"
if
This question already has an answer here:
Bash: command not found
2 answers
bash
bash
edited Dec 30 '18 at 8:24
Kulfy
3,97851240
3,97851240
asked Dec 30 '18 at 8:14
susan bhattraisusan bhattrai
11
11
marked as duplicate by Sergiy Kolodyazhnyy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 30 '18 at 8:40
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Sergiy Kolodyazhnyy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 30 '18 at 8:40
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Only use Kali tags while referring to problems specific to Kali. Moreover, Kali is off-topic here.
– Kulfy
Dec 30 '18 at 8:26
add a comment |
1
Only use Kali tags while referring to problems specific to Kali. Moreover, Kali is off-topic here.
– Kulfy
Dec 30 '18 at 8:26
1
1
Only use Kali tags while referring to problems specific to Kali. Moreover, Kali is off-topic here.
– Kulfy
Dec 30 '18 at 8:26
Only use Kali tags while referring to problems specific to Kali. Moreover, Kali is off-topic here.
– Kulfy
Dec 30 '18 at 8:26
add a comment |
1 Answer
1
active
oldest
votes
Here I see two problems,
Syntax of
if
: You seem to have not followed the proper syntax. It must be like
if [ <condition> ] #mind the whitespaces
Moreover you need to compare values of
usr_value
anda
not value ofa
withusr_value
as a value, i.e. in your codeusr_value
is being treated as a string value not a variable. So, it should be like
if [ "$usr_value" = "$a" ]
if else
should be ended withfi
but you have usedif
again in the end ofif else
statements.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here I see two problems,
Syntax of
if
: You seem to have not followed the proper syntax. It must be like
if [ <condition> ] #mind the whitespaces
Moreover you need to compare values of
usr_value
anda
not value ofa
withusr_value
as a value, i.e. in your codeusr_value
is being treated as a string value not a variable. So, it should be like
if [ "$usr_value" = "$a" ]
if else
should be ended withfi
but you have usedif
again in the end ofif else
statements.
add a comment |
Here I see two problems,
Syntax of
if
: You seem to have not followed the proper syntax. It must be like
if [ <condition> ] #mind the whitespaces
Moreover you need to compare values of
usr_value
anda
not value ofa
withusr_value
as a value, i.e. in your codeusr_value
is being treated as a string value not a variable. So, it should be like
if [ "$usr_value" = "$a" ]
if else
should be ended withfi
but you have usedif
again in the end ofif else
statements.
add a comment |
Here I see two problems,
Syntax of
if
: You seem to have not followed the proper syntax. It must be like
if [ <condition> ] #mind the whitespaces
Moreover you need to compare values of
usr_value
anda
not value ofa
withusr_value
as a value, i.e. in your codeusr_value
is being treated as a string value not a variable. So, it should be like
if [ "$usr_value" = "$a" ]
if else
should be ended withfi
but you have usedif
again in the end ofif else
statements.
Here I see two problems,
Syntax of
if
: You seem to have not followed the proper syntax. It must be like
if [ <condition> ] #mind the whitespaces
Moreover you need to compare values of
usr_value
anda
not value ofa
withusr_value
as a value, i.e. in your codeusr_value
is being treated as a string value not a variable. So, it should be like
if [ "$usr_value" = "$a" ]
if else
should be ended withfi
but you have usedif
again in the end ofif else
statements.
edited Dec 30 '18 at 8:39
answered Dec 30 '18 at 8:33
KulfyKulfy
3,97851240
3,97851240
add a comment |
add a comment |
1
Only use Kali tags while referring to problems specific to Kali. Moreover, Kali is off-topic here.
– Kulfy
Dec 30 '18 at 8:26