I have a basic script that runs inside another script. I call mass_split.sh which then invokes split_file.sh. The splite_file.sh takes two arguments -s file_name.txt and -c 1 (how many slices to cut the file). However I trying to run a loop to find all text file names in directory ./ and then input the results to the cut_file.sh . I am getting no results back and then text files are not being split.
mass_split.sh
#!/bin/bash
for f in ./*.txt
do
sudo bash split_file.sh -s echo "file '$f'"; -c 10
done
sudo bash [script] ...indicates to me that you're not 1) setting the script executable or 2) using a magic shebang, otherwise it would readsudo ./split_file.sh .... (applies to split_file.sh, not mass_split.sh which we can see the shebang for)sudo bash split_file.sh -s $f -c 10-c10part after the;will return: command not found. Drop the;Also, when I exclude thebash split_file.sh ...(because i don't have that command nor the code) it lists the files perfectly. You might as well show the code forsplit_file.sh. It might help.