Setting vi- command-line editing by hft13158

VIEWS: 9 PAGES: 2

									Workbook 6 Part 1
Understanding Shell Functions + Variables
1. List all the hidden files in your home directory.
   ___________________________________________________________________
   ___________________________________________________________________

2. Type myname =<yourname> to create a variable called myname which has the value of
   yourname in it.

3. Display the value of the variable called echo $myname

4. Now start a new bash subshell to check if this variable works in the new bash shell too.

5. Display the value of the variable called echo $myname

6. Type exit to leave this bash shell and return to the previous shell

7. exit back to the previous shell.

8. Then log out of unix and log back in to see if the change stays.

9. Type set to display all your current variables.

10. Is the myname variable still there?

11. Use the set command and wordcount to identify how many global or system wide
    environmental variables there are. __________________

12. Use the previous display to identify and then write down the values for each of the
    following environmental variables.

        $PATH
        $HOME
        $LOGNAME
        $USER
        $SHELL
        $PS1
        $MAIL
        $PWD
        $HISTFILE
        $HISTSIZE
        $HOSTNAME
        $HOSTTYPE

13. Enter the command: echo HOME What is displayed? __________________________

14. Enter the command: echo $home What is displayed? __________________________

15. Enter the command: echo $HOME What is displayed? __________________________

16. What does the $ sign do when placed infront of a variable name & used in a command.
    _______________________________________________________________________

                                          1
17. Create a variable called first which equals the internal value of one by typing the following
    FIRST=1

18. Display the value of the variable called first. echo $FIRST

19. Type set to list all your local variables and see if it is there.

20. Type export to list all your exported variables and see if it is there.

21. Export the variable called export FIRST

22. Type export to list all your exported variables and see if it is there.

23. Type bash to start a new subshell and check it is there.

24. Type set to list all your local variables in this subshell.

25. Display the value of the variable called first. echo $FIRST

26. Log out then log back in – Are your variables still there and exported?


Now lets modify an existing global variable to customize our local environment.

27. Type set and find the HISTSIZE variable – write down it’s size. _________

28. Type history and identify how many entries it has. ___________________

29. Type cat .bash-history to view the actual history file.

30. Type cat .bash-history | wc to view your .bash-history file and identify how many
    entries it has. ______________________

31. Use your up arrow key to move back thru your command history.

32. Type HISTSIZE=3

33. Use your up arrow key to move back thru your command history.

34. Type set and find the HISTSIZE variable – write down it’s size. _________

35. Type history and identify how many entries it has. ___________________

36. Now Log out then log back in.

37. Are your variables still there and exported?

38. Has your HISTSIZE remained changed?




                                             2

								
To top