Just had the same issue. My solution:
process_1 | process_2 &
PID_OF_PROCESS_2=$!
PID_OF_PROCESS_1=`jobs -p`
Just make sure process_1 is the first background process. Otherwise, you need to parse the full output of jobs -l
.
More Related Contents:
- Some troubles with using sed and awk [closed]
- How can I manipulate text in bash? [closed]
- How do I use shell variables in an awk script?
- How can I do a recursive find/replace of a string with awk or sed?
- Bash tool to get nth line from a file
- How to merge every two lines into one from the command line?
- bash: shortest way to get n-th column of output
- awk in bash with ls and variable
- Remove first N lines of a file in place in unix command line
- How to add to the end of lines containing a pattern with sed or awk?
- Sort a text file by line length including spaces
- Parsing variables from config file in Bash
- How to make awk ignore the field delimiter inside double quotes? [duplicate]
- Parse out key=value pairs into variables
- Specify other flags in awk script header
- Check if all of multiple strings or regexes exist in a file
- Parsing a CSV file using gawk
- Split CSV files into smaller files but keeping the headers?
- Bash: Parse CSV with quotes, commas and newlines
- How to remove double-quotes in jq output for parsing json files in bash?
- find difference between two text files with one item per line [duplicate]
- Grep output with multiple Colors?
- Using grep to search for hex strings in a file
- How to append a string at end of a specific line in a file in bash [duplicate]
- How to strip out all of the links of an HTML file in Bash or grep or batch and store them in a text file
- Parse HTML using shell
- using bash (sed/awk) to extract rows AND columns in CSV files?
- What is the shortest way to get n-th column of an output?
- How to grep for case insensitive string in a file?
- How can I format the output of a bash command in neat columns