Scripts examples with read command

[davsingh@noisecover-dr Scripts]$ read test
davinder singh
[davsingh@noisecover-dr Scripts]$ echo $test
davinder singh
[davsingh@noisecover-dr Scripts]$ read firstname lastname
davinder singh
[davsingh@noisecover-dr Scripts]$ echo $firstname
davinder
[davsingh@noisecover-dr Scripts]$ echo $lastname
singh
[davsingh@noisecover-dr Scripts]$ echo $firstname $lastname
davinder singh

Comments

  1. Adding a few more here

    [anil@indian ~]$ read -p "enter your name : " yourname
    enter your name : anil

    It gives better readability

    [anil@indian ~]$ read -s name
    [anil@indian ~]$ echo $name
    anil

    hiding while writing the input

    always use -s before -p , in case you want to use both of them.

    ReplyDelete

Post a Comment

Popular posts from this blog

How to delete SEA in VIOS

Webmin configuration for LDAP

Sample questions and answers for AWS Associate Solutions Architect Certification ---> AWS exam dumps