Skip to main content

All Questions

Tagged with
0 votes
1 answer
518 views

I'm trying to write a find and cd function like so: findcd () { cd "$(dirname "$(find '$1' -type '$2' -name '$3')")" } to be called like so: find . f [FILE_NAME] But it's ...
Mathew's user avatar
  • 243
1 vote
1 answer
347 views

I sometimes use characters such as ! and $ in commit messages, they need to be manually escaped, but not if you use single quotes like this git commit -m 'My $message here!'. I tried to write a ...
Justin Breen's user avatar
5 votes
3 answers
1k views

Here is a simplified code that prints the name of Directory if it contains a Filename with same name as the parent directory and .md extension. FIND(){ find . -type d -exec sh -c ' for d ...
Porcupine's user avatar
  • 2,196
1 vote
3 answers
677 views

I have the following command to remote into a local server and tail -f the latest log file for an application that I have. The command works perfectly fine from the command line - ssh user@hostname ...
mattdonders's user avatar
3 votes
1 answer
7k views

The following works great on the command-line: $ ffmpeg -i input.m4a -metadata 'title=Spaces and $pecial char'\''s' output.m4a How do I parameterize this command and use it in a script/function? I ...
Leftium's user avatar
  • 173
1 vote
1 answer
1k views

I'm trying to write a simple bash function to search-and-replace recursively down a directory, changing one string to another. Here's what I've got: function sar () { from="$1" shift to="$...
Chap's user avatar
  • 389
0 votes
2 answers
532 views

Not sure why this is producing error. This is a test code emulating my real code. I want to write a wrapper for find and want to allow for any argument, so I'm wrapping each arg in single quotes. #...
codechimp's user avatar
  • 207
12 votes
2 answers
23k views

I have the following function: bar() { echo $1:$2; } I am calling this function from another function, foo. foo itself is called as follows: foo "This is" a test I want to get the ...
Konrad Rudolph's user avatar
5 votes
2 answers
4k views

I love using the following pattern for searching in files: grep --color=auto -iRnHr --include={*.js,*.html,} --exclude-dir={release,dev,} "span" . I'd like, however, to have this one wrapped into a ...
oleq's user avatar
  • 383