bash内置变量IFS作为内部单词分隔符,其默认值为<space><tab><newline>, 我想设置它仅为\n,于是:
OLD_IFS=$IFS
IFS='\n'
# do some work here
IFS=$OLD_IFS
但结果为:IFS把单独的字符当作了分隔符,即分隔符被设置成下划线和字母n 。
Why ?
通过google搜索,得知需要把\n转化成ANSI-C Quoting, 方法是把字符串放入$'string'中,即应该设置成:
IFS=$'\n'
顺便搜了下$字符的用途,在Unix & Linux, 中解释了字符串前面加$字符的两种形式,一种是单引号,一种是双引号,即
There are two different things going on here, both documented in the bash manual
$'
Dollar-sign single quote is a special form of quoting: ANSI C Quoting Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard.
$"
Dollar-sign double-quote is for localization: Locale translation A double-quoted string preceded by a dollar sign (‘$’) will cause the string to be translated according to the current locale. If the current locale is C or POSIX, the dollar sign is ignored. If the string is translated and replaced, the replacement is double-quoted.
因此单引号表示转化成ANSI-C字符,双引号则表示将字符串本地化。
以下是一个实例,ping /etc/hosts的主机名为video-开头的主机名,检查网络状况!
#!/bin/bash
trap "echo 'interrupted!';exit 1" SIGHUP SIGINT SIGTERM
OLD_IFS=$IFS
IFS=$'\n'
for i in `awk '$0!~/^$/ && $0!~/^#/ && $2~/^video/ {print $1,$2}' /etc/hosts`
do
ADDR=$(echo $i | cut -d' ' -f 1)
DOMAIN=$(echo $i | cut -d' ' -f 2)
if ping -c 2 $ADDR &>/dev/null
then
echo $DOMAIN ok!
else
echo $DOMIN dead!
fi
done
IFS=$OLD_IFS
2023年4月26日 19:43
I am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me. disney clogs shoes
2023年4月29日 03:48
Please share more like that. jordan matching shirts
2023年4月29日 19:53
Thank you again for all the knowledge you distribute, Good post. I was truly interested in the composition, it's fairly inspiring I should admit. I like visiting you point since I always come through intriguing paperslikethisone.Great Job, Igreatlyappreciatethat.Do Keep sharing! felicitations, Vape Carts For Sale in New Hampshire
2023年4月30日 00:45
Thanks for the post and great tips..even I also think that hard work is the most important aspect of getting success.. aspjzy
2023年4月30日 18:56
Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. transparent-merchant
2023年5月01日 01:32
Thanks for sharing nice information with us. i like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. spiralteck
2023年5月06日 19:34
thank you for a great post. Is a prestige pressure cooker worth buying
2023年5月11日 19:39
Love to read it,Waiting For More new Update and I Already Read your Recent Post its Great Thanks. rat snakes for sale
2023年5月14日 05:23
thanks this is good blog. nevada registered agents
2023年5月14日 17:44
Love to read it,Waiting For More new Update and I Already Read your Recent Post its Great Thanks. registered agent georgia
2023年5月14日 20:50
Thank you very much for the sharing! COOL.. registered agent new york
2023年5月15日 23:18
Nice Informative Blog having nice sharing.. new jersey registered agent
2023年5月16日 16:17
Please share more like that. Koreansk hudpleje
2023年5月20日 20:29
That is really nice to hear. thank you for the update and good luck. straw clutch purse
2023年5月21日 00:43
This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work Luxury
2023年5月21日 23:52
i love reading this article so beautiful!!great job! freetechdownloads
2023年5月25日 20:49
Thanks for a wonderful share. Your article has proved your hard work and experience you have got in this field. Brilliant .i love it reading. situs bokep
2023年5月28日 16:13
Thanks for a wonderful share. Your article has proved your hard work and experience you have got in this field. Brilliant .i love it reading. film porno
2023年5月28日 19:44
Wonderful article, thanks for putting this together! This is obviously one great post. Thanks for the valuable information and insights you have so provided here. situs bokep
2023年5月30日 04:08
Wonderful article, thanks for putting this together! This is obviously one great post. Thanks for the valuable information and insights you have so provided here. video porno
2023年6月01日 16:00
Your website is really cool and this is a great inspiring article. Thank you so much. film porno
2023年6月09日 21:57
very interesting keep posting. link bokep
2023年6月11日 16:34
Love to read it,Waiting For More new Update and I Already Read your Recent Post its Great Thanks. reit investment
2023年6月13日 16:28
Wow i can say that this is another great article as expected of this blog.Bookmarked this site.. น้ำผลไม้ธรรมชาติ
2023年6月14日 15:45 thank you for a great post. สล็อต
2023年6月18日 15:45
This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work resume
2023年6月20日 01:03
Please share more like that. mandoo
2023年6月20日 18:02
thanks for this usefull article, waiting for this article like this again. Aplikasi Lowongan Kerja
2023年6月25日 01:17
i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future.. solar panels
2023年6月26日 23:56
Thank you for taking the time to publish this information very useful! solar panel system
2023年7月01日 04:10
Wow what a Great Information about World Day its very nice informative post. thanks for the post. bokep indo
2023年7月02日 08:52
i love reading this article so beautiful!!great job! situs bokep
2023年7月03日 00:44
Thank you for taking the time to publish this information very useful! film porno
2023年7月03日 14:00
This is such a great resource that you are providing and you give it away for free. situs bokep
2023年7月03日 19:15
CRDSTORE offer high-quality Fullzinfo based from our long selling experience and aim to connect with buyers for reliable and secure transactions.
2023年7月05日 04:29
Thank you for the update, very nice site.. lunchtime result
2023年7月06日 23:55
It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. North India tour package
2023年7月08日 05:18
I know your expertise on this. I must say we should have an online discussion on this. Writing only comments will close the discussion straight away! And will restrict the benefits from this information. fia togel
2023年7月10日 02:42
Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it's quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job, I greatly appreciate that.Do Keep sharing! Regards, Softech Source
2023年7月10日 15:27
Thanks for the post and great tips..even I also think that hard work is the most important aspect of getting success.. Best App Development Company In Germany
2023年7月10日 18:50
Thanks for this article very helpful. thanks. yowes togel
2023年7月10日 19:15
I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. ทางเข้าUFABET
2023年7月11日 04:15
Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!THANKS!!!!!! UFABET เข้าสู่ระบบทางเข้า
2023年7月12日 16:47
This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It is the old what goes around comes around routine. ทางเข้า ufabet มือถือ
2023年7月13日 03:09
this is really nice to read..informative post is very good to read..thanks a lot! situstoto
2023年7月14日 18:07
This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post! สล็อต
2023年7月15日 16:39
Please share more like that. link bokep
2023年7月15日 22:20
This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. situs porno
2023年7月16日 11:02
Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging, situs bokep
2023年7月16日 20:07
thanks this is good blog. น้ำผลไม้สด
2023年7月17日 04:24
Please share more like that. Reiki
2023年7月18日 19:13
This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It is the old what goes around comes around routine. Apunkagames
2023年7月24日 02:12 Most of the time I don’t make comments on websites, but I'd like to say that this article really forced me to do so. Really nice post! link bokep
2023年7月25日 00:46
This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work bokep jepang
2023年7月25日 06:29
Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article. bokep jepang
2023年7月25日 21:43
I appreciated your work very thanks situs porno
2023年7月26日 02:21 Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it's quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job, I greatly appreciate that.Do Keep sharing! Regards, amazon sellers
2023年7月27日 05:19
thank you for a great post. bingo89
2023年7月28日 22:12
I am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me. film porno
2023年7月30日 00:33
This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work situs porno
2023年7月30日 18:21
Nice Informative Blog having nice sharing.. video porno
2023年7月31日 00:16 It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. Indoor Outdoor Custom Furniture
2023年7月31日 00:16 It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. Indoor Outdoor Custom Furniture
2023年7月31日 00:20
It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. Indoor Outdoor Custom Furniture
2023年7月31日 07:01
i love reading this article so beautiful!!great job! bokep indo
2023年8月02日 02:25
thanks for this usefull article, waiting for this article like this again. group insurance broker
2023年8月02日 05:15
Thank you for the update, very nice site.. facial skin analyzer
2023年8月03日 15:25
KozyBlanket is a leading provider of cozy blankets, offering a diverse range of products including fleece blanket , quilt blanket and hoodie blankets, and many customized blanket options including photo blanket, name blanket... With a focus on customer satisfaction, KozyBlanket creates blankets that combine comfort, style, and personalization. We strives to bring warmth and joy to customers' lives through our exceptional blanket designs.
2023年8月04日 18:54
This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work Cookr
2023年8月05日 17:57
The main characteristic of a 3d hoodie is its three-dimensional design. The graphics on the hoodie are printed in a way that creates an illusion of depth and texture, giving the design a lifelike appearance.
2023年8月06日 12:27
Thank you very much for this useful article. I like it. video porno
2023年8月07日 14:05
Thank you for taking the time to publish this information very useful! Spider man crocs
2023年8月07日 18:49
Thanks for a wonderful share. Your article has proved your hard work and experience you have got in this field. Brilliant .i love it reading. <a href="https://jda.daftarsxs.online/oo/mawartoto/">bokep indo</a>
2023年8月07日 18:49
Thanks for a wonderful share. Your article has proved your hard work and experience you have got in this field. Brilliant .i love it reading. bokep indo
2023年8月08日 16:53
Florida attracts a significant number of international buyers, particularly from countries in Latin America and Europe. The state's global appeal and cultural diversity contribute to this trend. Miami Beach property
2023年8月09日 15:30
By sourcing their medications from trusted suppliers and adhering to stringent quality standards, these pharmacies ensure that consumers can access the treatments they need without breaking the bank. Canadian pharmacy
2023年8月10日 15:35
Thank you for taking the time to publish this information very useful! Organization Development
2023年8月11日 04:22
thanks for this usefull article, waiting for this article like this again. the fate
2023年8月13日 13:26
Reputable moving companies offer insurance coverage to protect your belongings in case of accidents or damages during the move. Vancouver Moving - Phone: (604) 721-4555
2023年8月13日 13:53
OpenAI promotes the responsible and ethical use of ChatGPT to avoid any potential negative consequences. ChatGPT Jailbreak
2023年8月13日 17:41
ChatGPT can understand and interpret human language, allowing it to engage in meaningful conversations with users. Guide to Chat GPT
2023年8月13日 23:29
AI creates images through a process called "generative modeling," where artificial intelligence algorithms learn to generate new images that resemble a given dataset. Stable Diffusion
2023年8月14日 13:35
Chatbots are designed for a higher level of relationships concurrently, ensuring effective and scalable customer support or information dissemination. Top 5 NSFW Chatbots of 2023
2023年8月14日 17:09 AI is successful at solving complicated dilemmas, frequently concerning big levels of knowledge or difficult variables. It may analyze patterns, produce forecasts, and build insights. Undress AI program
2023年8月15日 01:31
The Chai App is a versatile and user-friendly mobile application designed to streamline and enhance the way people manage their personal finances and make payments. With its array of features, the Chai App offers users a comprehensive platform to effortlessly handle their financial transactions and gain better control over their money.
2023年8月15日 15:24
New web site is looking good. Thanks for the great effort. Cymath
2023年8月17日 01:32
In the realm where art and technology converge, the emergence of AI art generators has revolutionized the creative landscape. This innovative fusion of artificial intelligence and artistic expression has opened new horizons, allowing artists and enthusiasts to explore uncharted territories of imagination. Hotpot AI
2023年8月17日 13:40
AI-generated selfies can transport individuals back in time by applying historical clothing, hairstyles, and aesthetics. AI Selfie
2023年8月18日 00:06
Ecoute AI provides context-aware insights, such as song lyrics, artist information, and album details, enriching the audio experience. Ecoute AI
2023年8月19日 13:05
Some kayaking tours offer customizable itineraries, allowing you to craft a journey that aligns with your preferences. kayaking in canada
2023年8月19日 18:44
Draped under a Disney blanket, dreams become more vivid and whimsical, inspired by the characters that inhabit them. custom disney blankets
2023年8月20日 12:50
President Joe Biden has an empathetic, plainspoken communication style that aims to bring Americans together. joe biden ai voice
2023年8月26日 23:48
Interactive brushes equipped with technology enable artists to blend colors, adjust brush strokes, and experiment digitally and on paper. Craiyon
2023年8月27日 14:28
Great article Lot's of information to Read...Great Man Keep Posting and update to People..Thanks Trending In Ecommerce
2023年8月27日 15:57
SQL supports the concept of transactions, allowing multiple operations to be grouped together and ensuring data consistency even in case of failures. <a href="https://www.123topai.com/how-to-use-chatgpt-to-write-sql-queries/">How to Use ChatGPT To Write SQL Queries</a>
2023年8月27日 15:58
SQL supports the concept of transactions, allowing multiple operations to be grouped together and ensuring data consistency even in case of failures. How to Use ChatGPT To Write SQL Queries
2023年8月30日 21:11
What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much. situs porno
2023年8月31日 22:03
ChatGPT's responses are not financial advice but rather AI-generated insights that should be verified and evaluated. Advantages of Using ChatGPT to Trade Stocks
2023年9月02日 14:43
While ChatGPT can generate creative responses to ‘Dan’ prompts, it has a limited ability to understand the context or backstory associated with ‘Dan’. This can lead to responses that are inconsistent or that don’t make sense within the given scenario. Who Uses ‘Dan’ Prompts in ChatGPT?
2023年9月03日 15:16 AI-driven chatbots and virtual assistants enhance customer service and support. AI in Education
2023年9月11日 20:04 Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon. kontol kuda
2023年9月13日 05:14
"AI" represents Synthetic Intelligence. It refers to the simulation of individual intelligence procedures by computer systems. ChatGPT Login
2023年9月13日 19:54
Designers use visual hierarchy to emphasize important content and guide users through the website. This involves arranging elements such as headings, images, and buttons in a way that draws attention to key information. web design
2023年9月14日 19:32
IPOs can offer significant opportunities for companies to raise capital and provide investors with the chance to invest in promising companies in their early stages. However, they also come with risks and challenges, and it's important for both companies and investors to carefully consider their options and conduct due diligence before participating in an IPO. OpenAI IPO date
2023年9月16日 00:10
this is really nice to read..informative post is very good to read..thanks a lot! link bokep
2023年9月18日 18:02
OpenAI offers extensive documentation, guides, and tutorials to help developers understand how to use their APIs effectively. This educational content supports developers in creating successful integrations. openai labs
2023年9月19日 01:43
AI models like OpenAI's can translate text from one language to another with a high degree of accuracy. OpenAI Interview Questions
2023年9月20日 03:07
In summary, "Unstable Diffusion" refers to the unpredictable and chaotic behavior that can occur in diffusion processes, particularly in fluid dynamics and heat transfer, when conditions become unstable or rapidly changing. This phenomenon is of significant interest in various scientific and engineering disciplines.
2023年9月22日 13:43
This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. situs bokep
2023年9月25日 18:37
Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon. best nsfw chatbot
2023年9月26日 18:31
Love to read it,Waiting For More new Update and I Already Read your Recent Post its Great Thanks. situs bokep
2023年9月26日 18:53
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. situs bokep
2023年9月27日 22:45
Admiring the time and effort you put into your blog and detailed information you offer!.. situs bokep
2023年9月28日 02:56
That is really nice to hear. thank you for the update and good luck. film porno
2023年9月29日 01:57
Please share more like that. 10 สัญลักษณ์เกมส์สล็อต
2023年10月01日 19:27
I appreciated your work very thanks daftar mawartoto
2023年10月13日 22:10
i really like this article please keep it up. طلب تأشيرة نيوزيلندا
2023年10月16日 00:42
Most of the time I don’t make comments on websites, but I'd like to say that this article really forced me to do so. Really nice post! วิธีแทงบอลสูงต่ำ
2023年10月16日 17:47
What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much. รวมเว็บUFABET
2023年10月17日 00:01
This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. UFABETสมัครเว็บตรงแทงบอล
2023年10月17日 13:47
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. UFABETแอพ แทงบอลออนไลน์
2023年10月17日 18:23
i really like this article please keep it up. Canada Visa Helpdesk
2023年10月18日 18:16
i really like this article please keep it up. Solicitud en línea de visa de Canadá
2023年10月19日 12:07
This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. د کاناډا ویزې آنلاین
2023年10月19日 19:33
This article gives the light in which we can observe the reality. This is very nice one and gives indepth information. Thanks for this nice article. تأشيرة كندا للأعمال
2023年10月24日 20:17
Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks تأشيرة تركيا عبر الإنترنت من جمهورية الدومينيكان
2023年10月25日 20:28
i really like this article please keep it up. สมัครแทงบอลฟรีเว็บUFABET
2023年11月02日 01:07
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. Thanks... duk
2023年11月09日 04:16
I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. 안전토토
2023年11月13日 17:53
I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. situs bokep
2023年11月15日 15:23
Nice Informative Blog having nice sharing.. 360 Booths
2023年11月21日 12:52
Thanks for sharing this useful info.. 메이저놀이터
2023年11月21日 13:35
Your website is really cool and this is a great inspiring article. Thank you so much. 안전놀이터
2023年11月22日 21:57
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. situs bokep
2023年11月24日 18:15
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. kontol kuda
2023年11月30日 18:56
Your website is really cool and this is a great inspiring article. Thank you so much. situs porno
2023年12月25日 13:24
Thank you for taking the time to publish this information very useful! vaishno devi helicopter booking
2024年1月06日 20:40
I am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me. bokep indo
2024年1月14日 02:06
i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future.. situs porno
2024年1月21日 05:41
Thank you for taking the time to publish this information very useful! Visit website
2024年1月27日 20:15
What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much. Pocket Knife Buying Guide 2024
2024年5月29日 06:02
i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future.. Medical Malpractice Injury Lawyers Santa Ana, Orange County
2024年6月06日 08:17
I think this is a standout amongst the most critical data for me. What"s more, i"m happy perusing your article. Be that as it may, ought to comment on some broad things
2024年9月06日 10:35
Whoa! This is such a great and useful post. I adore it utterly. It's fantastic and really excellent. I'm in complete awe. I hope that you'll go on doing this kind of work in the future. 印度 e 簽證資格 沙烏地阿拉伯公民
2024年10月17日 13:38
There are innumerable blogs in the world of the internet. But trust me, this site contains every single detail that makes it exceptional. I'll return time and time again. допустимост за индийска електронна виза граждани на никарагуа