You are not logged in.
Pages: 1
This is the script that I am using with the find command to calculate a number of files:
if [ 'XX'"$RLASTFILENUMBER" != 'XX' ]; then
export RLASTFILENUMBER="1"
fi
RLASTFILENUMBER=$(echo $RLASTFILENUMBER+1 | bc -l );
Gives errors like: (standard_in) 1: syntax error
I need it to make a limit of files in the folder before other actions.
Help to make Arora bug free!!
日不落 | Year 2081 | 笑傲江湖 | One more a really good book in my collection the Drystoll.
Offline
bash can do integers just fine on its own:
$ echo $((123+1))
124
Edit:
$ export RLASTFILENUMBER="1"
$ echo $(($RLASTFILENUMBER+1))
2
Last edited by karol (2014-06-29 11:18:24)
Offline
I am exporting variables outside of the script but cannot read from within script.
Help to make Arora bug free!!
日不落 | Year 2081 | 笑傲江湖 | One more a really good book in my collection the Drystoll.
Offline
You said you were using this script with `find`, but you didn't describe how exactly. You need to describe the context better, what you're doing, what you're trying to do, etc.
This silver ladybug at line 28...
Offline
I'm not sure what's the correct way of doing this, but
#!/bin/bash
foo="1"
echo $(($foo+1))
works.
Offline
I am using like
$ export DDD="1"
#!/bin/bash
export DDD=$(echo $(($DDD+1)))
echo $DDD
I want it to remmember the variable value outside of the script. Because I need to run this script many times and cannot keep everything inside.
Help to make Arora bug free!!
日不落 | Year 2081 | 笑傲江湖 | One more a really good book in my collection the Drystoll.
Offline
Can you post the rest of the script, the 'find' part?
You can make it read a value from a file, if needed.
Offline
I am using something like
find * -type f -name * -exec myscript.sh \;
each time it runs the script a new value should be stored and calculated.
It will take more time if a file will be created for variables. I am making script for finding files by type and sort them by folders. I have more then 50 000 files and I want to automate searching and sorting out of images and other files by a type. In a preview post you can see the more important part of the script, but I solved it, only this part with calculation left.
Last edited by Andy_Crowd (2014-06-29 13:01:15)
Help to make Arora bug free!!
日不落 | Year 2081 | 笑傲江湖 | One more a really good book in my collection the Drystoll.
Offline
'find -type f -exec myscript.sh \;' should work too.
What does myscript.sh do?
Offline
you can read this post my solved post
Help to make Arora bug free!!
日不落 | Year 2081 | 笑傲江湖 | One more a really good book in my collection the Drystoll.
Offline
Pages: 1