Answers for "shell load file as variable"

1

shell load file as variable

# Basic syntax:
FILELINES=`cat your_file.txt`

# Example usage:
# Say you have a file "your_file.txt" containing the following sample names
# and you want to iterate over them in a bash script:
SAMPLE1
SAMPLE2
SAMPLE3
# The bash script would look like:
SAMPLES = `cat your_file.txt`
for SAMPLE in $SAMPLES; do
	echo $SAMPLE
done
Posted by: Guest on January-17-2022

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language