Hiddenworlds225
Posts: 8
Joined: Tue Jul 04, 2017 8:26 pm

How to detect and use files in BASH

Thu Oct 05, 2017 12:06 am

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?

User avatar
scruss
Posts: 1824
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: How to detect and use files in BASH

Thu Oct 05, 2017 12:12 am

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"
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Hiddenworlds225
Posts: 8
Joined: Tue Jul 04, 2017 8:26 pm

Re: How to detect and use files in BASH

Thu Oct 05, 2017 7:55 pm

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.

User avatar
rpdom
Posts: 12884
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: How to detect and use files in BASH

Thu Oct 05, 2017 8:01 pm

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.

Hiddenworlds225
Posts: 8
Joined: Tue Jul 04, 2017 8:26 pm

Re: How to detect and use files in BASH

Fri Oct 13, 2017 7:53 pm

ah... So he was correct.

Return to “Advanced users”