I want to write a bash script that receives a list of files through a pipe, writes a tempfile and then starts a program (qiv – an image viewer) with this tempfile. Example: where piped_qiv would look something like this: I’m probably missing something very basic about bash scripting but I was not …
Tag: bash
Are linux shell pipes pipelined?
Given a file input.txt if I do something like is the output from the first command continuously passed (as soon as it is generated) as input to the second command? Or does the pipe wait until the first command finishes to start running the second command? Answer Yes, they’re pipelined — each compo…
Why can’t bash recognize the existence of a socket file
On a Linux box I want to check if a specific socket file exists. I know the socket files exists, but my checks in bash don’t show that to me: Why oh why can’t bash see that the file exists? Answer http://www.tldp.org/LDP/abs/html/fto.html Use -S to test if its a socket. -f is for regular files. Se…
bash process monitor script echo empty when no process found
I’ve created a process monitor to check for the presence of a running process, and if found we need to check its parent to determine if it is acceptable or not, it’s a security check basically. It works great when I look for running processes and gives me output that I expect. However, for some re…
Jenkins shell string quotation replacement
I have a Jenkins job with an execute shell box. In the execute shell I use bash instead of dash (sh). In the execute shell I have strings which are supposed to be interpreted as they contain escape sequences (in this case the new line: n), so here is an example execute shell: My problem here is that the scrip…
Prevent case statement from continually asking for input so that I can carry out subsequent commands
I have the following code which includes a case statement. My problem is that once a file is selected from the option menu, it subsequently keeps asking me to input further choices, but I only want to input one then carry out out the subsequent commands (in this case the subsequent command is at the bottom (e…
unterminated `s’ command error – trying to remove extra double quote
I am trying to edit a single row in a text file, by removing an unnecessary double quote in front of the name, i.e. “THE DELEON FAMILY DE. After the change it should look like this: THE DELEON FAMILY DE. Here is my code: This is the error I get: Answer You are missing a the last / in the
Use awk to create file
I have a file that contain : Mr Q 01629699998 Ms Nhung 011287633 … I would like to use this awk ‘{print “BEGIN:VCARD”;print “Name:”$0;print “TELEPHONE:”$0;print “END:VCARD”}’ file to create this result BEGIN:VCARD Name: Mr Q TELEPHONE:016296999…
bash: daemonizing by forking process as a new child
I have a bash script which should daemonize itself after being run. My solution looks as follows: However, putting the whole script itself inside the function child does not seem the correct thing to do. Unfortunately exec & won’t fork-off the whole process into a backgrounded child. How can a achie…
open a file in editor and then save it back by terminal on bash [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 …