Advertisement
alexarcan

lab2OS

Oct 7th, 2015
2,884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SPARQL 0.60 KB | None | 0 0
  1. Ex de la lab2 OS
  2. #ex1
  3.  
  4. /bin/bash
  5. contor=$#  #fara spatiu!!! numarul de argumente cu care a fost apelat fisierul de comenzi curent
  6. cmd=echo #cmd ia val stringului echo
  7. while test $contor -gt 0 #while contor > 0
  8. do
  9. cmd="$cmd \$$contor"
  10. contor=`expr $contor - 1`
  11. done
  12. eval $cmd
  13.  
  14.  
  15. #--------------------------------------
  16.  
  17. #ex2
  18.  
  19. #!/bin/bash
  20. var=`ls`
  21. contor=1
  22. for i IN $var
  23. do
  24. echo  "$contor $i"
  25. contor=`expr $contor + 1`
  26. done
  27.  
  28. #----------------------------------------
  29.  
  30. #ex3
  31.  
  32. #!/bin/bash
  33. var=`ls $1`
  34. contor=1
  35. for i IN $var
  36. do
  37. echo  "$contor $i "
  38. contor=`expr $contor + 1`
  39. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement