Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. #!/bin/bash
  2. FILE=$1
  3.  
  4. if [ -f $FILE ];
  5. then
  6. echo "File $FILE exists."
  7. else
  8. echo "File $FILE does not exist."
  9. fi
  10.  
  11. #!/bin/bash
  12. FILE=$1
  13.  
  14. if [ $FILE does not exist ];
  15. then
  16. echo "File $FILE does not exist."
  17. fi
  18.  
  19. if [ ! -f /tmp/foo.txt ]; then
  20. echo "File not found!"
  21. fi
  22.  
  23. #!/bin/bash
  24. FILE=$1
  25.  
  26. if [ ! -f "$FILE" ]
  27. then
  28. echo "File $FILE does not exists"
  29. fi
  30.  
  31. [[ -f $FILE ]] || printf '%s does not exist!n' "$FILE"
  32.  
  33. if [[ ! -f $FILE ]]; then
  34. if [[ -L $FILE ]]; then
  35. printf '%s is a broken symlink!n' "$FILE"
  36. else
  37. printf '%s does not exist!n' "$FILE"
  38. fi
  39. fi
  40.  
  41. if [ ! -f "$file" ]; then
  42. echo "$file"
  43. fi
  44.  
  45. test -f "$file" || echo "$file"
  46.  
  47. [ -f "$file" ] || echo "$file"
  48.  
  49. #!/bin/bash
  50. file=./file
  51. if [ -e "$file" ]; then
  52. echo "File exists"
  53. else
  54. echo "File does not exist"
  55. fi
  56.  
  57. #!/bin/bash
  58. file=./file
  59. if [ ! -e "$file" ]; then
  60. echo "File does not exist"
  61. else
  62. echo "File exists"
  63. fi
  64.  
  65. $ [ -f "/$DIR/$FILE" ] || echo "$FILE NOT FOUND"
  66.  
  67. $ [ -f "/$DIR/$FILE" ] && echo "$FILE FOUND"
  68.  
  69. $ [ -f "/$DIR/$FILE" ] || { echo "$FILE NOT FOUND" ; exit 1 ;}
  70.  
  71. $ [ -f ]
  72. $ echo $?
  73. 0
  74. $ [ -f "" ]
  75. $ echo $?
  76. 1
  77.  
  78. #!/bin/sh
  79. FILE=$1
  80.  
  81. if [ ! -f "$FILE" ]
  82. then
  83. echo "File $FILE does not exist."
  84. fi
  85.  
  86. if [ ! -f /tmp/foo.txt ];
  87. then
  88. echo "File not found!"
  89. fi
  90.  
  91. if [ ! -f /tmp/foo.txt ]
  92. then echo "File not found!"
  93. fi
  94.  
  95. if ! [ -f /tmp/foo.txt ]
  96. then echo "File not found!"
  97. fi
  98.  
  99. if ! [ -f /tmp/foo.txt ]; then echo "File not found!"; fi
  100.  
  101. [ ! -f /tmp/foo.txt ] && echo "File not found!"
  102.  
  103. [ -f /tmp/foo.txt ] || echo "File not found!"
  104.  
  105. #!/bin/bash
  106. FILE=$1
  107.  
  108. if [ -f $FILE ];
  109. then
  110. echo "File $FILE exists"
  111. else
  112. echo "File $FILE does not exists"
  113. fi
  114.  
  115. test -e FILENAME && echo "File exists" || echo "File doesn't exist"
  116.  
  117. check-file(){
  118. while [[ ${#} -gt 0 ]]; do
  119. case $1 in
  120. fxrsw) [[ -f "$2" && -x "$2" && -r "$2" && -s "$2" && -w "$2" ]] || return 1 ;;
  121. fxrs) [[ -f "$2" && -x "$2" && -r "$2" && -s "$2" ]] || return 1 ;;
  122. fxr) [[ -f "$2" && -x "$2" && -r "$2" ]] || return 1 ;;
  123. fr) [[ -f "$2" && -r "$2" ]] || return 1 ;;
  124. fx) [[ -f "$2" && -x "$2" ]] || return 1 ;;
  125. fe) [[ -f "$2" && -e "$2" ]] || return 1 ;;
  126. hf) [[ -h "$2" && -f "$2" ]] || return 1 ;;
  127. *) [[ -e "$1" ]] || return 1 ;;
  128. esac
  129. shift
  130. done
  131. return 0
  132. }
  133.  
  134. FILE=$1
  135. [ ! -e ${FILE} ] && echo "doest not exist" || echo "exist"
  136.  
  137. echo "entre file"
  138.  
  139. read a
  140.  
  141. if [ -s /home/trainee02/simmant/$a ]
  142.  
  143. then
  144.  
  145. echo "yes file is there "
  146.  
  147. else
  148.  
  149. echo "soryy file is not there"
  150.  
  151. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement