Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell 在unix中处理文件时如何忽略*_Shell_Unix_Glob - Fatal编程技术网

Shell 在unix中处理文件时如何忽略*

Shell 在unix中处理文件时如何忽略*,shell,unix,glob,Shell,Unix,Glob,这是我的档案: cat abx.txt select * from table1; select * from table2; select * from table3; yu=$(head -1 abx.txt) echo $yu =>从表中选择file1.txt file2.txt 分配给变量时,如何避免处理*。我已经添加了\*,但是变量的值为\*当您回显$yu时,文件名正在扩展。您只需将变量用双引号括起来即可防止: $ yu=$(head -1 abx.txt) $ echo "$y

这是我的档案:

cat abx.txt

select * from table1;
select * from table2;
select * from table3;

yu=$(head -1 abx.txt)
echo $yu
=>从表中选择file1.txt file2.txt


分配给变量时,如何避免处理
*
。我已经添加了
\*
,但是变量的值为
\*

当您回显
$yu
时,文件名正在扩展。您只需将变量用双引号括起来即可防止:

$ yu=$(head -1 abx.txt)
$ echo "$yu"
select * from table1;