Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试读取一个在灰壳中包含一个数字的文件。这样做的 bash 方式
ARG=`cat /tmp/tempfile`
不起作用,我知道 ARG 在这行代码之后没有任何内容。
尝试用引号将其括起来以使其不会在第一个换行符处停止:
ARG="`cat /tmp/tempfile`"
或者
ARG="$(cat /tmp/tempfile)"
read ARG </tmp/tempfile #only 1st line will be read