All Questions
12 questions
0
votes
1
answer
98
views
Passing file types to bash function and calling find
I have the following bash function to print between two line numbers, for files watching file types .texi and .org recursively in a particular directory.
I would like to be able to supply the file ...
1
vote
2
answers
681
views
Executing user defined function in a find -exec call AND choosing version of that function based on arguments
This was my starting point: shell script - Executing user defined function in a find -exec call - Unix & Linux Stack Exchange
But I need to choose between 2 different versions of the function, ...
3
votes
2
answers
313
views
find - how do i make an alias to do something like (find . -iname '*$1*')?
I have a findn function:
findn () {
find . -iname "*$1*"
}
Using this function has one downside that I cannot use -print0 | xargs -0 command (I am using mac) following findn filename to extend ...
2
votes
2
answers
2k
views
set -f inside function
I have a directory with files file1.c, file2.c and file3.c. The command find outputs:
$find -name "*.c"
./file1.c
./file2.c
./file3.c
Then I would like to use find without the quotes around .*c. ...
-1
votes
1
answer
659
views
How can I add "find exec" command as a function to bashrc?
find . -name "*.mov" -exec bash -c 'ffmpeg -i "{}" -c:v libx264 -crf 20 -pix_fmt yuv420p "${0/.mov}.mp4"' {} \;
Above command works perfectly when I run it manually but I could not put it within a ...
0
votes
0
answers
63
views
Call function that call ffmpeg in loop [duplicate]
I have function like this (got it form some website long ago):
function flv2mp3() {
ffmpeg -y -i "$1" -acodec libmp3lame "$(echo -n "$1" | sed -e 's/\.[^\.]*$//').mp3"
}
and I'm trying to call ...
0
votes
1
answer
64
views
Bash function does not work recurrsively [duplicate]
Directory Structure:
one.pdf
./subdir/two.pdf
./anothersubdir/three.pdf
When I type:
find ./ -type f -name "*.pdf"
it retrieves all the pdfs, including subdirectories.
Bash Function
function ...
4
votes
3
answers
6k
views
Applying bash function to each file in subfolder recursively
I am trying to write a script that will apply a bash function for each file in a directory recursively. For example if the directory tests had all my files and sub-directories in it, the script
find ...
4
votes
4
answers
3k
views
locate alias with find
On small systems where there is no locate installed, How would an alias look like that gets the same result as locate?
I can imagine find can produce the same output so an alias could look like
...
4
votes
4
answers
5k
views
Scope of variables when calling function from find
In a bash script I define a function that is called from find. The problem is that the scope of variables does not extend to the function. How do I access variables from the function? Here is an ...
5
votes
3
answers
9k
views
Find functions, commands, and builtins [duplicate]
Possible Duplicate:
Executing user defined function in a find -exec call
Suppose I have the following bash code:
!#/bin/bash
function print_echo (){
echo "This is print_echo Function" $1;
}
...
47
votes
4
answers
43k
views
Executing user defined function in a find -exec call
I'm on Solaris 10 and I have tested the following with ksh (88), bash (3.00) and zsh (4.2.1).
The following code doesn't yield any result:
function foo {
echo "Hello World"
}
find somedir -exec ...