Suppose I have a folder: /usr/lib/x86_64-linux-gnu/wxcrafter containing some library files and their corresponding symlinks, e.g: /usr/lib/x86_64-linux-gnu/wxcrafter/lib1.so.0 -> /usr/lib/x86_64-linux-gnu/wxcrafter/lib1.so.0.0.0 /usr/lib/x86_64-linux-gnu/wxcrafter/lib2.so.0 -> /usr/lib/x86_64-linux-gnu/…
Tag: shell
Echo only valid user
Bash newbie question: I’d like to have this script echo out only users from a given list that are valid user IDs, and not echo the invalid ones. Here’s what I have so far: Instead, it is echoing out the results of ‘id’ as well as the text “is not valid user ID” Ideally, it&…
Does all linux users are present on /etc/passwd? [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …
How to run command CTRL+Z in Shell?
I have a Node progress. I want to auto-start it and keep it in background via a shell script. The way I keep background progress is press crtl+Z after run npm run start, then run bg && disown. Now I’ve got a problem: How to process this crtl+Z command in Shell script? Answer Another way to run a…
Linux bash to iterate over apache access_log files and send mail
I need a linux bash script which send me an email if any results appear in searches made in the apache logs. I have a very simple method (sentence) to look into SQL Injection attacks, which simply searches for some keywords used in SQLi. Is this: So now I would like to be able to launch it in several access_l…
Use a modified variable in bash script, trying to change git branch programatically
I’m playing around with my custom commands, and I’m currently trying to change a remote Git branch programatically using bash. The idea is this function will try to find the branch issue_X, if it does it switches, otherwise it creates and sets the remote origin. The problem is git branch -u origin…
Is every command handled differently in input redirection in a shell (linux)?
For example wc -l filename would print out for example “3 filename”, while wc -l < filename would print out only “3” disregarding “filename”. This means there must have been some program that got rid of “filename” with the addition of input redirection “…
No cursor motion capability occurs when startup linux script execute minicom script with at commands
I have created a startup Linux script for a board that runs Debian jessie Armbian 8.1. I need at startup to run at command in a modem attached to it via USB interface. I’ve put the script inside rc.local: In the folder Script I have a script: The at_command contains: The issue is that when I run the scr…
Use bash -s with other arguments
I have install.sh script which is located in server. I want to write one line code to download and run the script. Everything works fine until I am trying to set arguments It can’t recognize ‘-p’ as an argument but ‘abc’ can. How to set arguments in this situation starting with &…
Why does flock removes existing text from a file?
So, I am trying to get an exclusive lock on a text file using Flock and a line of text to that file however while doing so it removes whatever text was there earlier. So if the file had let’s say and after running the script I am expecting something like instead, all I get is why would it behave