In batch scripting what does the expression %* expand? [duplicate] - image-processing

This question already has answers here:
What does %* mean in a batch file?
(5 answers)
Closed 9 years ago.
I have a batch script which has got a line
echo %* >> test.txt
%PROCESS% %*
What does the expression %* denote and expand to?

It simply expands to the arguments passed in to the shell/batch file. e.g.
foo.bat:
echo %*
and then doing
c:\> foo.bat abcefg hijkl 1 2 3
echo abcefg hijkl 1 2 3
abcefg hijkl 1 2 3
c:\>

Related

why do I always get a syntax error in shell script running inside a container [duplicate]

This question already has answers here:
Are shell scripts sensitive to encoding and line endings?
(14 answers)
Closed last year.
I'm trying to run a shell script to build a docker image, but always getting a error that I cannot correct:
Neomind_dev | build.sh: line 3: syntax error near unexpected token `$'\r''
'eomind_dev | build.sh: line 3: `fi
but the code is super simple:
if [ ! "$(ls /usr/local/fusion)" ]; then
echo aaa
fi
cp /usr/local/fusion/target/fusion-Neomind-dev.war /usr/local/tomcat/webapps/fusion.war
can someone help me?
Run
dos2unix your_script.sh
or
sed -i 's/\r//' your_script.sh

Bash script to grep string from latest files in folder [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Can you help me with a bash script to grep string from latest files in folder. e.g. I have a folder /var/log/folder with some files, and I need to every 30 seconds grep text string some string from latest 5 files and result should be written in file /var/log/file.txt.
Thank you in advance!
This should do it
You'd need to put it into cron
cd /var/log/folder && grep "some string" `ls -c | head -n 5\` > /var/log/file.txt
if you need to append to the log, use >> rather than >
You can use below script. Just modify condition in while loop as per your requirement.
#!/bin/bash
mydir="/var/log/"
rm ${mydir}/file.txt
while [ 1 ]
do
date >> ${mydir}/file.txt
ls -tr ${mydir}/folder/ | tail -n 5 | awk -v var="${mydir}" '{print var"/folder/"$1}' | xargs grep "Some String" >> ${mydir}/file.txt
sleep 30
done

how to use svm-scale in LIBSVM?

I tried running the command svm-scale -l 0 -u 1 -s range data.data > data_scaled.data but I get the error: SyntaxError: invalid syntax. Please find details in the picture below.
I am running the command in a Windows command shell using a Python interface. Is my command format wrong?
I assume, that you use the original LIBSVM (as mentioned in the title of your question) package from here.
There the call should be svm-scale -l 0 -u 1 -s scaledParameters.txt input.data
According to the code, it will print the scaled output to your terminal. The -s option will write down the ranges of your feature values, e.g.
x
0 1
1 63375 13454352
2 1 10
3 1 10
4 1 10
5 1 10
6 1 10
7 1 10
8 1 10
9 1 10
10 1 10
If you just want to scale your data, you have to adapt the LIBSVM scale code to write the scaled data into a file.

vim nerdtree files show up with * appended [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
gVim displays every file with an asterisk on the right (and bold)?
I'm using vim with nerdtree plugin for my rails projects and some of the files show up with a * appended to the filename. They are also a different color from the other files.
edit.html.erb*
index.html.erb
show.html.erb*
What does the * mean?
The key is the executable bit. For example, if you do this:
$touch no_exec_file exec_file
$chmod -v u+x exec_file
$ls -lF
total 0
-rwxr--r-- 1 reoo reoo 0 2012-09-19 19:14 exec_file*
-rw-r--r-- 1 reoo reoo 0 2012-09-19 19:14 no_exec_file
You can see the '*' in the exec_file, now, if you open VIM, you can see the '*' symbol again in the exec_file.
So, the NERDTree plugin shows the '*' symbol for those files that can be execute by the user.
It means that your files are executable, meaning you gave them the permission to be executable. Or they are files like .exe for example.

runnig a commad in terminal is working and then runing same command by b bash script is not working

echo how many testcases
read s1
echo Enter the Testcases
for (( c=1; c<=$s1; c++ ))
do
read a1
a[$c]=$a1
#echo ${a[$c]}
done
for (( c=1; c<$s1; c++ ))
do
str=${a[$c]}'|'
str1=$str1$str
done
str1=$str1${a[$c]}
echo $str1
str1=\($str1\)
echo $str1
CMD="ruby final2.rb --name "\"\/test_$str1\/\"
#echo $CMD
$CMD
i have the testsuite final2.rb which contains test_1 test_2 test_3 test_4 test_5 test_6 test_7 as testcases in it.
Above i have created a script that will take only the number of testcases to run like
1
2
5 these will be converted to the pattern ruby final2.rb --name "/test_(1|2|5)/"
As we know this command runs the testcases:-
test_1 test_2 test_3 in the testsuite final2.rb.
but when executed using Bash Script the test suite runs only for a milli seconds like..
DEMO
*Loaded suite final2
Started
Finished in 0.000135 seconds.
0 tests, 0 assertions, 0 failures, 0 errors*
but if i write the same command ruby final2.rb --name "/test_(1|2|5)/"
in termial myself the desired testcases runs and the output is
***Loaded suite final2
Started
Finished in 124.1212135 seconds.
3 tests, 6 assertions, 0 failures, 0 errors***
so
runnig a commad in terminal is working and then runing same command by script is not working...
any suggestions..
help
to ran system command you need to wrap it in this quotes "`":
`CMD="ruby final2.rb --name "\"\/test_$str1\/\"`
another aproaches: System call from Ruby

Resources