mercredi 25 août 2021

What does forwardslash mean between two variables in an IF statement in shell? [duplicate]

I am trying to understand what the forward slash between the two variables here does?

"${lsof_line/$c2}"

Below is context. (c2_iocs is a text file)

lsof_output=$(lsof -i)
for lsof_line in ${lsof_output}; do
    for c2 in "${c2_iocs[@]}"; do
        # echo "$lsof_line - $c2"
        if [ "${lsof_line/$c2}" != "$lsof_line" ]; then
            log warning "[!] C2 server found in lsof output SERVER: $c2 LSOF_LINE: $lsof_line"
        fi
    done
done

Aucun commentaire:

Enregistrer un commentaire