Skip to content

Instantly share code, notes, and snippets.

@dewomser
Last active November 11, 2025 15:29
Show Gist options
  • Select an option

  • Save dewomser/56fe1b1b138aa55e6e51accbd732c730 to your computer and use it in GitHub Desktop.

Select an option

Save dewomser/56fe1b1b138aa55e6e51accbd732c730 to your computer and use it in GitHub Desktop.
diff für Inhalt von Variablen und Arrays . 2 Beispiele in Bash
/bin/bash
#für arrays
a=(1 2 3)
b=(1 2 5)
unset ia;for i in "${a[@]}";do ia="$ia$i\n"; done
unset ib;for i in "${b[@]}";do ib="$ib$i\n"; done
diff <( echo -e "$ia" ) <( echo -e "$ib" )
#!/bin/bash
# für Variablen
a="1
2
3"
b="1
2
4"
diff <( echo "$a" ) <( echo "$b" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment