Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Is this script with variable done right?

I was making a script in Linux.
Which first asks the question of your name
then as in cmd we write x this corresponds to x.

 

This part works. But the second part doesn't work.
Then it asks how old you are and it turns off.

It should be so that we enter how old we are and if we are 18, we invite you to answer, and if not, buy it.

 

What does $ a and -gt mean?

-gt probably means that when we are 18, we invite you to answer and buy if less responds.

 

I'm still sending photos.

1.jpg

2.jpg

Link to comment
Share on other sites

Link to post
Share on other sites

You asked for age but did not capture the input

Add

read a

after

echo "ile masz lat"

 

36 minutes ago, GamerGry123 said:

What does $ a and -gt mean?

This line

if (test $a -gt 18)

is checking to see if the value ($a) is greater than (-gt) 18

 

Test is a program that compares two values. Run man test for documentation

 

36 minutes ago, GamerGry123 said:

'm still sending photos.

You dont need to take screenshots of your code. Press the <> button when posting code.

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×