Skip to content

Tag: bash

Find command in linux bash shell

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…

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…

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…