Question regarding bash syntax as per Beginner Basics Scripting lesson
Solved
Linux
-
Hi, everyone.
In this course (https://app.itpro.tv/course-library/linux-shell-scripting-basics/loops2-linuxscripting/?autostart=1), Don and Daniel go over this script:
https://i.imgur.com/I8ervsr.png
In the IFS=$'\n' variable assignment, what is the "$" sign used for in assigning \n\ (which is new line?) to IFS? I understand that we use a dollar sign next to a already set variable we wish to expand, but is that the case here? And why the quotes?
Please help me understand how this works.
Thanks.
-
In this case, the $ means we are setting a default value for a session variable. It's confusing, but the $ is used for multiple purposes in Bash scripting.
Thanks,
Don