5,321
edits
(→Usage) |
|||
Line 36: | Line 36: | ||
===Check if File/Folder Exists=== | ===Check if File/Folder Exists=== | ||
See [https://linuxize.com/post/bash-check-if-file-exists/#check-if-directory-exist https://linuxize.com/post/bash-check-if-file-exists/#check-if-directory-exist]. | See [https://linuxize.com/post/bash-check-if-file-exists/#check-if-directory-exist https://linuxize.com/post/bash-check-if-file-exists/#check-if-directory-exist]. | ||
===Arrays=== | |||
<syntaxhighlight lang="bash"> | |||
DRIVES=( | |||
/media/veracrypt1 | |||
/media/veracrypt2 | |||
/media/veracrypt3 | |||
/media/veracrypt4 | |||
/media/veracrypt5 | |||
/media/veracrypt6 | |||
/media/veracrypt7 | |||
/media/veracrypt8 | |||
/media/veracrypt9 | |||
) | |||
for i in "${DRIVES[@]}" | |||
do | |||
ls $i | |||
done | |||
</syntaxhighlight> | |||
;Notes | |||
* <code>"${DRIVES[@]}"</code> means every element will be a new word | |||
* <code>"${DRIVES[*]}"</code> will expand the array into a single word | |||
==<code>.bashrc</code>== | ==<code>.bashrc</code>== |