我想使用linux命令打开一个gif文件。该文件的名称是“颤动期间心脏电活动的模拟(与实验比较).gif”。
我使用以下命令:
$display <Simulation of electrical activity in the heart during fibrillation\(\with comparison with experiment\)\.gif>
Run Code Online (Sandbox Code Playgroud)
它给了我
-bash: syntax error near unexpected token `newline'
Run Code Online (Sandbox Code Playgroud)
它出什么问题了?谢谢你!
原因
display <filename>
Run Code Online (Sandbox Code Playgroud)
给您一个syntax error near unexpected token newline问题是,您所遵循的任何文档中的箭头括号都不是按字面意思理解的。
A<表示后面的内容是用于stdin输入的文件名,a>表示后面的内容是用于stdout输出的文件名;因此,>命令末尾的 a 是一个语法错误,因为它期望后面跟随一个文件名,而不是换行符。
相反,使用:
display filename
Run Code Online (Sandbox Code Playgroud)
...在这个特殊情况下:
display 'Simulation of electrical activity in the heart during fibrillation (with comparison with experiment).gif'
Run Code Online (Sandbox Code Playgroud)