I am using find in a Bash script. How can I modify that code to include a specific directory under 'bin' , ie './bin/php/' (while still ignoring all other sub-directories of 'bin')?
Current code:
find . -name '*.php' \
-and ! -path './bin/*' \
...
I have a variable that contains the following space separated entries.
variable="apple lemon papaya avocado lemon grapes papaya apple avocado mango banana"
How do I remove the duplicates without sorting?
#Something like this.
new_variable="apple lemon papaya avocado grapes mango banana"
I have found somewhere a script that accompli...
Hi I want to write a shell scripting which will return the installed JRE version. How to write shell script file to achieve the above.
If I write java -version then the application returns "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)".
But I donot want any strin...
how to a Write a script that runs a 5 instances of a child process in the background (at a gap of 5 seconds) and do a continuous check to see if any of the child process is completed it starts another instance of the same process till the child process has executed 20 instances.
...
Warning: malicious code. Do not try this. It appears here for educational purposes only.
If you type this shell snippet in your shell, your system seems stopped, do you know why?
:() { :|:& }; : #
the only thing you can do is reboot your system..
Can you gimme some explanation
...
Please tell me what is the difference in bash shell between launching a script with
./script.sh and . ./script.sh?
...
I've got a set of files in a web root that all contain special characters that I'd like to remove (Â,€,â,etc).
My command
find . -type f -name '*.*' -exec grep -il "Â" {} \;
finds & lists out the files just fine, but my command
find . -type f -name '*.*' -exec tr -d 'Â' '' \;
doesn't produce the results I'm looking for.
Any thou...
Please tell me how to export a function in parent shell (bash , sh or ksh) so that the function will be available to all the child process launced from the parent process?
...
I have the following code in KornShell
FAILURE=1
SUCCESS=0
isNumeric(){
if [ -n "$1" ]; then
case $1 in
*[!0-9]* | "") return $FAILURE;
* ) return $SUCCESS;
esac;
else
return $FAILURE;
fi;
}
#...
FILE_EXT=${FILE#*.}
if [ isNumeric ${FILE_EXT} ]; then
echo "...
Hi,
I have a directory filled with files with random names. I'd like to be able to rename them 'file 1' 'file 2' etc based on chronological order, ie file creation date. I could be writing a short Python script but then I wouldn't learn anything. I was wondering if there's a clever 1 line command that can solve this. If anyone could poi...
On a Linux system, I have a very large text file and I need to create a new text file which contains every line between the first and last of occurrence of a particular sessionId (those lines included).
I guess I probably need to use sed or something?
As a bonus, sometimes I won't know which log file will contain the session trace. So ...
How can I spawn a process after a delay in a shell script? I want a command to start 60 seconds after the script starts, but I want to keep running the rest of the script without waiting 60 seconds first. Here's the idea:
#!/bin/sh
# Echo A 60 seconds later, but without blocking the rest of the script
sleep 60 && echo "A"
echo "B"
echo...
So I do a lot of shell scripts and I am constantly having to enter in paths and I was wondering if anyone knew of a way to get vim to autocomplete paths and files while in insert mode. Just like when you are in your favorite shell you tab to complete the directory or file.
Extra credit if you can get CTRL-D functionality of the shell i...
Now my program generates two data files. a.txt and b.txt
Take a.txt as an example, it's content just like this:
0,0
0,1
1,0
-3,1
1,-2
1,3
......
b.txt is similar with a.txt.
Now, I hope to find out difference lines count.
In other words, for example, if b.txt like this:
0,0
1,1
1,2
-3,1
1,-2
1,3
......
a shell script output 2 as...
Now my program generates two data files. a.txt and b.txt
Take a.txt as an example, it's content just like this:
0,0
0,1
1,0
-3,1
1,-2
1,3
......
b.txt is similar with a.txt.
Now, I hope to find out average distance between the corresponding content in a and b file.
In other words, for example, if b.txt like this:
0,0
1,1
1,2
-3,1
...
Hi *,
I'm trying to find out if my install scrip is running on a Mac or Linux device.
Can someone give me a hint?
Thanks
Burntime
...
I have a shell script that runs as part of a Run Script phase in my targets that conditionally copies some files into the product. If I modify the shell script then rebuild, the script is not run because the target does not know that there is a dependency there.
How can I add a dependency so that modifications to the shell script cause ...
I want to write a perlscript on my iPhone that is able to give me a heads up at certain points so I'm wondering how I would go about doing that.
Is there a way to get a message through the gui from a script running in the background? I've been looking without much luck. I had a thought about inserting a fake sms into the sqlite db as a l...
I'm currently working on a build tool where its come up that it would be desirable to support code generation. Currently the tool simply compiles any out of date C and C++ source files it finds in the current folder when it's invoked. There's some support for custom build targets, which could create files, but the tool will ignore them b...
Does exist in linux bash something similar to the following code in PHP:
list($var1, $var2, $var3) = function_that_returns_a_three_element_array() ;
i.e. you assign in one sentence a corresponding value to 3 different variables.
Let's say I have the bash function myBashFuntion that writes to stdout the string "qwert asdfg zxcvb".
Is ...