the find command is: I want to convert to: so my code (is doesn’t work): Answer What you are attempting cannot be solved in the general case with “classic sh” because you need your script to work correctly with directories named * or ‘”[ ]”‘, and plain old flat string…
Tag: bash
“sh: line 1: Moved: command not found” installing npm with curl | sh
I attempted to install npm on mac OSX Yosemite with the command: And I received the following message: Any suggestions on how to resolve this issue? Answer You’re missing the curl -L option to follow redirects. However, you don’t need to use this installation method anymore, npm comes with node an…
grep -A until a string
assuming that we have a file containing the following: and we want to grep this file so we take the lines from chapter 1 blah blah to blah num (the line before the next chapter). The only things we know are the stating string chapter 1 blah blah somewhere after that there is another line starting with chapter…
Delete last executed command in Linux terminal
I want to do a clear but only of the last command I executed. Here is a example so you can understand it better: If that’s the current state of the shell I want to execute a command (for example echo a > /tmp/foo) and keep the console: So it should be something like echo a > /tmp/foo && cl…
How to manipulate text lines and Create two separate files for odd and even
How to manipulate text lines and Create two separate files for odd and even ? file 1: file 2: Answer I’d say This will print lines in inputfile that end with 1, 3, 5, 7, or 9 to file1 and all others to file2.
Python 3.4.3 subprocess.Popen get output of command without piping?
I am trying to assign the output of a command to a variable without the command thinking that it is being piped. The reason for this is that the command in question gives unformatted text as output if it is being piped, but it gives color formatted text if it is being run from the terminal. I need to get
Proper indentation of Bash script
I have written a Bash script which uses cases and functions for university, but no matter where I move the scripts, she says that they are not indented properly. What is the correct indentation of this sample of the script? Is there a website or a function on VMware where I can get my code automatically inden…
QtCreator – start external tool in an interactive bash
A while ago I discovered that you can make QtCreator call external tools directly from within the IDE and pass various arguments to those via the Tool->External. I find this pretty convenient however I’m currently struggling with the issue of starting a terminal-based application in an interactive ba…
Heroku buildpack: permission denied on npm install in bash script
I am creating a Heroku build pack and getting an npm permission denied when deploying with the build pack. Here’s the error from the build logs, permission denied when running npm install: I am packaging npm in a tar.gz and using that. In my compile file: Answer Is it possible that either npm or node is…
How to call this shell script to convert mysqldump to SQLite compatible syntax
I need to autonomously convert mysqldump files (.sql file) to SQLite compatible .sql files. I found this script on github which is supposed to be able to do this. If I had an unmodified .sql file from MySQL called test.sql whose database’s name was test and the script mysql2sqlite.sh in a directory, how…