I wanna a bash command to move to a directory, and then show 2 files’ content for each entry, I made this script:
cd /sys/class/net
for i in *; do echo $i; cat $i/{address,operstate}; done
is there anyway to do shorter and better?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
grep and sort can give a similar answer
Example output
I really liked the answer using tail, but unfortunately it keep the address and operstate next to each other. Using grep, I can fix this with sort. But it’s not one command, sorry.
The -T option to grep does the aligning (using a tab)