In cross-platform, lowest-common-denominator sh
you use:
#!/bin/sh
value=`cat config.txt`
echo "$value"
In bash
or zsh
, to read a whole file into a variable without invoking cat
:
#!/bin/bash
value=$(<config.txt)
echo "$value"
In case if you want to check whether file does not contain a specific string, you can do it as follows. if ! grep -q SomeString "$File...
No comments:
Post a Comment