User Tools

Site Tools


linux:bash:command

This is an old revision of the document!


Catatan Bash Command Linux

Beberapa catatan bash command linux

LS Modified File

Perintah LS Menampilkan File modifikasi terakhir

ls -1tr /folder/

LS Ignore file string

Perintah LS mengabaikan string file tertentu

ls -l /folder/ --ignore=*.java

Determinte Variable Empty or Not

Menentukan atau mengecek variable kosong atau berisi

ini apabila variable kosong

if [[ -z $variable ]]
if [[ -z "$variable" ]]

dan ini apabila tidak kosong

if [[ ! $variable ]]
if [[ ! "$variable" ]]

Bash Loop From LS

Looping dari hasil ls

bisa dengan cara ini

for task in $(ls -1tr  $task_file | head -3); do
...
...
done

atau anda bisa menyimpan command di dalam string kemudian mengeksekusi dengan eval. contoh seperti ini.

command='ls -1tr  $task_file  --ignore=auto* | head -3'
if [[ -z $command ]]; then
        command='ls -1tr  $task_file | head -3'
fi


for task in $(eval $command); do
...
...
done

Layanan

Harga Domain .COM | Harga Domain .ID | Shared Hosting | Email Hosting | MySQL Hosting |
linux/bash/command.1481515353.txt.gz · Last modified: 2016/12/11 23:02 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