Why are you printing Namespace using the awk command in the Network Namespace Bulk Delete command in the reference book?

Asked 2 years ago, Updated 2 years ago, 51 views

I am currently studying Network Namespace and found the following command in the reference book to delete Namespace in bulk.

forns in$ (ip netns list | awk'{print$1}'); do sudo ip netns delete $ns; done

Why does the above command interrupt the process of outputting the first column of Namespace output in awk as $(ip netns list | awk'{print$1}')?
As I checked with you, I was able to delete Namespace in bulk without interrupting the process of outputting awk as shown in the command below, so I would appreciate it if you could tell me why you are interposing awk commands like this.

forns in$(ip netns list); do sudo ip netns delete$ns; done

linux

2022-09-30 19:19

1 Answers

ip netns list may display nsid as well as nsname

%ip netns list
nsname1 (id:1)


2022-09-30 19:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.