String difference in Bash

Using diff or com or whatever you want:

diff  <(echo "$string1" ) <(echo "$string2")

Greg’s Bash FAQ: Process Substitution

or with a named pipe

mkfifo ./p
diff - p <<< "$string1" & echo "$string2" > p

Greg’s Bash FAQ: Working with Named Pipes

Named pipe is also known as a FIFO.

The - on its own is for standard input.

<<< is a “here string”.

& is like ; but puts it in the background

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)