Advertisement
buzzing_bee

for looping command line

Feb 16th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. [root@SERVER02 success]# ll
  2. total 48
  3. drwxr-xr-x 2 root root 4096 Feb 8 03:07 20130101
  4. drwxr-xr-x 2 root root 4096 Feb 8 03:07 20130102
  5. drwxr-xr-x 2 root root 4096 Feb 8 03:08 20130103
  6. drwxr-xr-x 2 root root 4096 Feb 8 03:09 20130104
  7. drwxr-xr-x 2 root root 4096 Feb 8 03:09 20130105
  8. drwxr-xr-x 2 root root 4096 Feb 8 03:10 20130106
  9. drwxr-xr-x 2 root root 4096 Feb 8 03:11 20130107
  10. drwxr-xr-x 2 root root 4096 Feb 8 03:11 20130108
  11. drwxr-xr-x 2 root root 4096 Feb 8 03:12 20130109
  12. drwxr-xr-x 2 root root 4096 Jan 11 00:00 20130110
  13. drwxr-xr-x 2 root root 4096 Jan 12 00:00 20130111
  14. drwxr-xr-x 2 root root 4096 Jan 13 00:00 20130112
  15. drwxr-xr-x 2 root root 4096 Jan 14 00:00 20130113
  16. drwxr-xr-x 2 root root 4096 Jan 15 00:00 20130114
  17. drwxr-xr-x 2 root root 4096 Jan 16 00:00 20130115
  18. drwxr-xr-x 2 root root 4096 Jan 17 00:00 20130116
  19. drwxr-xr-x 2 root root 4096 Jan 18 00:00 20130117
  20. drwxr-xr-x 2 root root 4096 Jan 19 00:00 20130118
  21. drwxr-xr-x 2 root root 4096 Jan 20 00:00 20130119
  22. drwxr-xr-x 2 root root 4096 Jan 21 00:00 20130120
  23. drwxr-xr-x 2 root root 4096 Jan 22 00:00 20130121
  24. drwxr-xr-x 2 root root 4096 Jan 23 00:00 20130122
  25. drwxr-xr-x 2 root root 4096 Jan 24 00:00 20130123
  26. drwxr-xr-x 2 root root 4096 Jan 25 00:00 20130124
  27. drwxr-xr-x 2 root root 4096 Jan 26 00:00 20130125
  28. drwxr-xr-x 2 root root 4096 Jan 27 00:00 20130126
  29. drwxr-xr-x 2 root root 4096 Jan 28 00:00 20130127
  30. drwxr-xr-x 2 root root 4096 Jan 29 00:00 20130128
  31. drwxr-xr-x 2 root root 4096 Jan 30 00:00 20130129
  32. drwxr-xr-x 2 root root 4096 Jan 31 00:00 20130130
  33. drwxr-xr-x 2 root root 4096 Feb 1 00:00 20130131
  34. drwxr-xr-x 2 root root 4096 Feb 2 00:00 20130201
  35. drwxr-xr-x 2 root root 4096 Feb 3 00:00 20130202
  36. drwxr-xr-x 2 root root 4096 Feb 4 00:00 20130203
  37. drwxr-xr-x 2 root root 4096 Feb 5 00:00 20130204
  38. drwxr-xr-x 2 root root 4096 Feb 6 00:00 20130205
  39. drwxr-xr-x 2 root root 4096 Feb 7 00:00 20130206
  40. drwxr-xr-x 2 root root 4096 Feb 8 00:00 20130207
  41. drwxr-xr-x 2 root root 4096 Feb 9 00:00 20130208
  42. drwxr-xr-x 2 root root 4096 Feb 10 00:00 20130209
  43. drwxr-xr-x 2 root root 4096 Feb 11 00:00 20130210
  44. drwxr-xr-x 2 root root 4096 Feb 12 00:00 20130211
  45. drwxr-xr-x 2 root root 4096 Feb 13 00:00 20130212
  46. drwxr-xr-x 2 root root 4096 Feb 14 00:00 20130213
  47. drwxr-xr-x 2 root root 4096 Feb 15 00:00 20130214
  48. drwxr-xr-x 2 root root 4096 Feb 16 00:00 20130215
  49. drwxr-xr-x 2 root root 4096 Feb 16 23:30 20130216
  50. -rw------- 1 root root 11732 Aug 28 16:50 nohup.out
  51.  
  52. ================
  53. didalam folder tanggal itu, ada file yg pengen dicompress
  54. ================
  55.  
  56. perintah biasa akan seperti ini:
  57. [root@SERVER02 success]# nohup bzip2 20130110/* &
  58. [1] 31333
  59. [root@SERVER02 success]# nohup: appending output to `nohup.out'
  60. [1]+ Done nohup bzip2 20130110/*
  61.  
  62. nohup: menjalankan command, jika tty ditutup command akan terus dijalankan
  63. bzip2 20130110/* : compress semua isi file didalam folder 20130110
  64. & : jalankan di background
  65.  
  66. ============================
  67. NOW, THIS IS MY PROB:
  68.  
  69. nah kalo satu2 kan lama, saya juga gak pengen bikin script (udah kebanyakan script di server)
  70. jadi saya pengen eksekusi semua folder dengan satu command line menggunakan looping. (malah dapat error)
  71.  
  72. [root@SERVER02 success]# for tgl in {10..31}; do nohup bzip2 201301$tgl/* done; &
  73. -bash: syntax error near unexpected token `&'
  74.  
  75. =====================================
  76. anybody can help??? :P
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement