Page 1 of 1

How to detect and use files in BASH

Posted: Thu Oct 05, 2017 12:06 am
by Hiddenworlds225
Hey, so i'm in a cyber security class and with what i have learned i wanted to test something: I built an encryption program that links to the BASH shell, yet i'm literally stuck until i can get the shell to detect certain files within a folder, but how?
I know only the basics of using the shell but not programming it.
Any suggestions?

Re: How to detect and use files in BASH

Posted: Thu Oct 05, 2017 12:12 am
by scruss
Think you might be slightly in the wrong subforum with this question, but you're looking for the test command.

Test can also be called with the [ command, for the slightly odd looking constructs:

Code: Select all

[ -f full.fzz ] && echo "file full.fzz is real"
[ -d blorp ] || echo "there is no blorp folder here"

Re: How to detect and use files in BASH

Posted: Thu Oct 05, 2017 7:55 pm
by Hiddenworlds225
Thanks man, plus,i'm not saying anything, But wouldn't BASH be classified as a bare metal because its what the system runs on, unless if you have it set up differently.

Re: How to detect and use files in BASH

Posted: Thu Oct 05, 2017 8:01 pm
by rpdom
Bare metal is a system without a standard OS (no Linux, for example).

Bash is merely one of the possible command line interpreters that can be run on the system. The system doesn't run on bash, bash runs on the system, as does everything else.

Re: How to detect and use files in BASH

Posted: Fri Oct 13, 2017 7:53 pm
by Hiddenworlds225
ah... So he was correct.