Skip to content
Advertisement

Tag: shell

Background rsync and pid from a shell script

I have a shell script that does a backup. I set this script in a cron but the problem is that the backup is heavy so it is possible to execute a second rsync before the first ends up. I thought to launch rsync in a script and then get PID and write a file that script checks if the

C Corrupted double-linked list after calling chdir

I’ve been working on some C code to provide functionality similar to the shell. So far it can run most commands like cat, ls, ls | grep …, etc. After writing code to implement the functions “cd”, “pwd”, “pushd” and “popd”, I have been testing it. If I write “cd ..” or “cd anydir” it will run “chdir(anydir)” and return

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 component’s stdout is connected to the stdin of

Comparing two files at end of line in Linux

I would like to compare two files and get the output of matching string in one of the files at the end of the line: Let’s say I have two files:- file1: file2: I could do something like this: This gives me the following output: This is because abcdef in file2 matches both of those lines in file1. However, what

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 script

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:01629699998 END:VCARD BEGIN:VCARD Name: Ms Nhung TELEPHONE:011287633 END:VCARD … But the code above does not get that,Anyone can help me ,thanks Answer Try: How it

Advertisement