我想通过辩论显示向我手稿提供的文件内容。 我需要利用正常的((a) lo和NOT(x) a。
This is my code. How should i put the file name correctly for that cat command?
for (( i=1;$i<=$#;i=$i+2 ))
do
cat $ $i #display the contents of the file currently being traversed
done
我想通过辩论显示向我手稿提供的文件内容。 我需要利用正常的((a) lo和NOT(x) a。
This is my code. How should i put the file name correctly for that cat command?
for (( i=1;$i<=$#;i=$i+2 ))
do
cat $ $i #display the contents of the file currently being traversed
done
你们可以使用这样的东西:
for (( i=1;$i<=$#;i=$i+1 ))
do
cat ${!i} #display the contents of the file currently being traversed
done
相应的手册部分:
If the first character of parameter is an exclamation point, a level of variable indirection is introduced. Bash uses the value of the variable formed from the rest of parameter as the name of the variable; this variable is then expanded and that value is used in the rest of the substitution, rather than the value of parameter itself. This is known as indirect expansion. The exceptions to this are the expansions of ${!prefix*} and ${!name[@]} described below. The exclamation point must immediately follow the left brace in order to introduce indirection.
诉讼的正常行为是回避论点。 3. 对所有论点进行回顾:
#!/bin/sh -e
for x; do cat $x; done
你可以稍作修改,只能根据你在很多不同场合所做的一切其他论点来做。 一种可能性是:
for x; do expr $(( i++ )) % 2 > /dev/null || cat "$x"; done
如果你坚持使用非标准表格,你可以使用“i!var} bashism”,而后者在绝大多数炮弹中将失败,或者你可以使用<代码>eval<>。
for (( i = 1; i <= $#; i += 2 ))
do
eval cat "$ $i"
done
For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...
How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks
i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...
Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...
I ve just installed Zend Studio 7.0.2 on my Linux-Ubuntu 9.10 system. There were no problems during the installation but when I try to create a new project, the New Project form hangs when I click ...
I am running valgrind as follows:- /usr/local/bin/valgrind "process_name" After excecution its giving me following error ==21731== ==21731== Warning: Can t execute setuid/setgid executable: ==...
I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...
Is there anything other than DDD that will draw diagrams of my data structures like DDD does that runs on Linux? ddd is okay and runs, just kind of has an old klunky feeling to it, just wanted to ...