Segmentation Fault in BASH

So I am writing a script that will interpret the partition table of a forensic evidence file, find the unallocated spaces, then determine if those spaces are empty or contain data.

I am stuck on the first command. *facepalm*

The command is mmls. When I run mmls <image> in BASH, no problem. When I run mmls in the script (even with nothing else), I get a segmentation fault (with a 4k or 5k number). This occurs whether I use $1 or $image as an argument for mmls.

Any help would be appreciated.

Without seeing your script, nobody here can really help you.

I would point out that TSK tools such as mmls are typically meant to be used interactively and not within a script.

I would also point out that it's not BASH that's segfaulting.

Apologies

#!/bin/bash -xv
image=$1
mmls $image

What if you just put the one line "mmls image_to_use" in the shell script (even leave out #! line). In other words, try the simplest case, see if that works, add in other details, find out the mistake.

Thanks for all the feedback everyone.

I got the answer from the Sleuthkit users list.

I needed to have "$image" in quotes. It turns out that when I used \ to escape the white space, the parent process chewed through that leaving the space unescaped by the time it was passed to the child process. Hope that makes sense.

Makes perfect sense.