With Perl in a shell:
ifconfig | perl -ane ' END{print "\042", join("\042,\042", @a), "\042\n"} $a[$c++] = $1 if /^(\w+)/; '
Try the following if you are using bash :
x=( $(ifconfig | grep -o '^[[:alnum:]]\+') ) for ((i=0; i<${#x[@]} -1; i++)); do printf '"%s",' ${x[i]} done printf '"%s"\n' ${x[-1]}
Based on Tom McClure but indiscriminately ls:
printf '"%s"\n' $( printf '%s\n' /sys/class/net/* | cut -d '/' -f 5 ) | paste -sd ","
source share