User Tools

Site Tools


linux:bash:command

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:bash:command [2016/12/11 22:44] – created kbadminlinux:bash:command [2023/06/06 06:06] (current) kbadmin
Line 11: Line 11:
 ls -l /folder/ --ignore=*.java ls -l /folder/ --ignore=*.java
 </code> </code>
 +===== Determinte Variable Empty or Not =====
 +Menentukan atau mengecek variable kosong atau berisi
 +
 +ini apabila variable kosong
 +<code>
 +if [[ -z $variable ]]
 +if [[ -z "$variable" ]]
 +</code>
 +dan ini apabila tidak kosong
 +<code>
 +if [[ ! $variable ]]
 +if [[ ! "$variable" ]]
 +</code>
 +
 +===== Bash Loop From LS =====
 +Looping dari hasil ls
 +
 +bisa dengan cara ini
 +<code>
 +for task in $(ls -1tr  $task_file | head -3); do
 +...
 +...
 +done
 +</code>
 +
 +atau anda bisa menyimpan command di dalam string kemudian mengeksekusi dengan eval. contoh seperti ini.
 +<code>
 +
 +command=ls -1tr  $task_file  --ignore=*.auto | head -3
 +if [[ -z $command ]]; then
 +        cmd='ls -1tr  $task_file | head -3'
 +else
 +        cmd='ls -1tr  $task_file  --ignore=*.auto | head -3'
 +fi
 +
 +
 +for task in $(eval $cmd); do
 +...
 +...
 +done
 +</code>
 +
 +===== TOP -c command =====
 +Top menampilkan proses linux filter berdasarkan command
 +<code>
 +top -bc |grep name_of_process
 +</code>
 +sumber : http://stackoverflow.com/a/24273554
 +
 +===== Mendapatkan Lokasi Path Saat ini - Current Working Path  =====
 +Berikut ini adalah command bash untuk mendapatkan lokasi pointer saat ini
 +<code>
 +$ echo "$PWD"
 +</code>
 +
  
  

Layanan

Harga Domain .COM | Harga Domain .ID | Shared Hosting | Email Hosting | MySQL Hosting |
linux/bash/command.1481514267.txt.gz · Last modified: 2016/12/11 22:44 by kbadmin

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki