Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed 5 years ago. Improve this question I’ve ran an empty Docker container with Ubuntu and created a …
Tag: bash
Bash – How to run code whenever USB device is connected
I am writing a bash script to automatically detect when my USB keyboard is plugged into my laptop (running Ubuntu 14), so I can change the keyboard layout automatically. Here is my code so far (I got it from another post on Stack Overflow so I’m not 100% sure how it works) I have got this to run on star…
Trimming string up to certain characters in Bash
I’m trying to make a bash script that will tell me the latest stable version of the Linux kernel. The problem is that, while I can remove everything after certain characters, I don’t seem to be able to delete everything prior to certain characters. Somehow the output “ignores” the wget…
why this code isn’t working in bash?
I am using tail -f to fetch log file and output of log this command is input to grep command with search for “ERROR” string and output of grep is used to create/write into a temporary file(tmpLog) . command : logfile content Issue is , i am not getting content in tmpLog file , although it is creat…
linux command line recursively check directories for at least 1 file with the same name as the directory
I have a directory containing a large number of directories. Each directory contains some files and in some cases another directory. I need to check that each sub_dir contains at least one file with the exact same name. I don’ need to check any further down if there are sub directories within the sub_di…
How to run npm or angular 2 ng serve command from Bash Script?
I am looking to create an interactive bash script for our development team (never did this before) as our project has various needs and due to future growth on the team I want this to be easy as pi. Normally for my work on the team I would change directory to the angular folder and run ng serve which kicks
Why does trying to kill a process in Docker container take me out of it?
I have a v6.10.0 Node server on my macOS that is automatically started from the CMD in the Dockerfile. Normally in my local development un-containerized environment I will use CTRL+C to kill the server. Not being able to (or not knowing how to) do this in the container, I resort to ps aux | grep node to try t…
common profile to record ssh sessions
I need to be able to record all ssh sessions on my server. After fumbling around with pam.d auditd, I found this enter link description here. And it looks to be working pretty well. However, when you “clear” the screen, your session log gets wiped as well. Is is possible to open a new log file whe…
Error in code for parsing arguments
i learned bash very recently, and i’m trying to read arguments for my script. So i wrote this, but i get an error (and vim has highlited in pink the last double parenthesis in the 4th line) I get the following error when i run ./test -so doc1 Can anyone help me understand what’s wrong with my scri…
AWK: variables not remembered outside actions?
I have a script that will give the percent of logins that are mine. This is done by matching all users, store to variable, then match me only (jdoe). I then use a basic operation to get the percent of logins that are mine. I get the error: ./loginPercent: line 13: eCount / totalCount: division by 0 (error tok…