An option is not seeing an argument (that is a variable) in bash, please help?











up vote
1
down vote

favorite














#!/bin/bash

counter=2

while [ $counter -lt 19 ]
do



username= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1
psswd= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f2
full_name= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f3
group= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f4
second_group= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f5

sudo useradd $username -m -g $group -s /bin/bash -c $full_name

if [ second_group = LPGestionnaires ]
then
usermod -a -G $second_group $user
fi

#echo "$username:$psswd" | chpasswd

((counter++))
done
echo Execution complete


The part where it says sudo useradd $username -m -g $group -s /bin/bash -c $full_name is the part that isn't working, my -g option isn't seeing the variable $group argument as an argument, when I execute my script it returns this: useradd: group '-s' does not exist



I'm pulling the data from a .csv file that is located correctly.



If anyone could help that would be great!



Thanks!










share|improve this question









New contributor




moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    1
    down vote

    favorite














    #!/bin/bash

    counter=2

    while [ $counter -lt 19 ]
    do



    username= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1
    psswd= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f2
    full_name= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f3
    group= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f4
    second_group= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f5

    sudo useradd $username -m -g $group -s /bin/bash -c $full_name

    if [ second_group = LPGestionnaires ]
    then
    usermod -a -G $second_group $user
    fi

    #echo "$username:$psswd" | chpasswd

    ((counter++))
    done
    echo Execution complete


    The part where it says sudo useradd $username -m -g $group -s /bin/bash -c $full_name is the part that isn't working, my -g option isn't seeing the variable $group argument as an argument, when I execute my script it returns this: useradd: group '-s' does not exist



    I'm pulling the data from a .csv file that is located correctly.



    If anyone could help that would be great!



    Thanks!










    share|improve this question









    New contributor




    moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite













      #!/bin/bash

      counter=2

      while [ $counter -lt 19 ]
      do



      username= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1
      psswd= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f2
      full_name= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f3
      group= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f4
      second_group= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f5

      sudo useradd $username -m -g $group -s /bin/bash -c $full_name

      if [ second_group = LPGestionnaires ]
      then
      usermod -a -G $second_group $user
      fi

      #echo "$username:$psswd" | chpasswd

      ((counter++))
      done
      echo Execution complete


      The part where it says sudo useradd $username -m -g $group -s /bin/bash -c $full_name is the part that isn't working, my -g option isn't seeing the variable $group argument as an argument, when I execute my script it returns this: useradd: group '-s' does not exist



      I'm pulling the data from a .csv file that is located correctly.



      If anyone could help that would be great!



      Thanks!










      share|improve this question









      New contributor




      moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.













      #!/bin/bash

      counter=2

      while [ $counter -lt 19 ]
      do



      username= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1
      psswd= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f2
      full_name= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f3
      group= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f4
      second_group= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f5

      sudo useradd $username -m -g $group -s /bin/bash -c $full_name

      if [ second_group = LPGestionnaires ]
      then
      usermod -a -G $second_group $user
      fi

      #echo "$username:$psswd" | chpasswd

      ((counter++))
      done
      echo Execution complete


      The part where it says sudo useradd $username -m -g $group -s /bin/bash -c $full_name is the part that isn't working, my -g option isn't seeing the variable $group argument as an argument, when I execute my script it returns this: useradd: group '-s' does not exist



      I'm pulling the data from a .csv file that is located correctly.



      If anyone could help that would be great!



      Thanks!







      command-line bash scripts






      share|improve this question









      New contributor




      moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 18 mins ago









      wjandrea

      8,07242258




      8,07242258






      New contributor




      moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 hour ago









      moltenmath

      83




      83




      New contributor




      moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          It seems you wanted to assign the result of the head ... command to the variable username here:




          username= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1 



          That is incorrect syntax. Correct it like this:



          username=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1)


          And then do the same for the other variables too, which all have the same problem.



          Also, change the sudo useradd command like this:



          sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"


          Variables used in command line arguments should usually be double-quoted to avoid word splitting.






          share|improve this answer























          • Thanks for the help! It now returns the man page for useradd for some reason...
            – moltenmath
            1 hour ago










          • @moltenmath change the sudo command like this: sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name". I suspect it won't work either, but we will get a more meaningful error output.
            – janos
            1 hour ago










          • Edit: Nevermind, none of the users were added to groups
            – moltenmath
            1 hour ago








          • 1




            @moltenmath add an echo statement to see better what's happening, for example echo sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"
            – janos
            57 mins ago










          • Thanks for all the help @janos this thread can now be closed, is that a thing here?
            – moltenmath
            34 mins ago




















          up vote
          0
          down vote













          The final code is this for anyone that is curious:



          #!/bin/bash

          counter=2

          while [ $counter -lt 19 ]
          do



          username=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1)
          psswd=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f2)
          full_name=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f3)
          group=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f4)
          second_group=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f5)

          sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"

          if [ "$second_group" = LPGestionnaires ]
          then
          sudo usermod -a -G LPGestionnaires "$username"
          fi

          echo "$username:$psswd" | sudo chpasswd

          ((counter++))
          done
          echo Execution complete





          share|improve this answer








          New contributor




          moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • You're almost re-inventing the newusers command here - at the very least, your script could be made somewhat neater by using a while loop (something like while IFS=';' read -r username passwd full_name group second_group; do stuff; done < ./user_sheet.csv)
            – steeldriver
            4 mins ago










          • @steeldriver I was just going to say something similar. For getting lines 2-19, I would use a sed command: done < <(sed -n '2,19 p' ./user_sheet.csv)
            – wjandrea
            1 min ago













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          moltenmath is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1102437%2fan-option-is-not-seeing-an-argument-that-is-a-variable-in-bash-please-help%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          It seems you wanted to assign the result of the head ... command to the variable username here:




          username= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1 



          That is incorrect syntax. Correct it like this:



          username=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1)


          And then do the same for the other variables too, which all have the same problem.



          Also, change the sudo useradd command like this:



          sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"


          Variables used in command line arguments should usually be double-quoted to avoid word splitting.






          share|improve this answer























          • Thanks for the help! It now returns the man page for useradd for some reason...
            – moltenmath
            1 hour ago










          • @moltenmath change the sudo command like this: sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name". I suspect it won't work either, but we will get a more meaningful error output.
            – janos
            1 hour ago










          • Edit: Nevermind, none of the users were added to groups
            – moltenmath
            1 hour ago








          • 1




            @moltenmath add an echo statement to see better what's happening, for example echo sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"
            – janos
            57 mins ago










          • Thanks for all the help @janos this thread can now be closed, is that a thing here?
            – moltenmath
            34 mins ago

















          up vote
          3
          down vote



          accepted










          It seems you wanted to assign the result of the head ... command to the variable username here:




          username= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1 



          That is incorrect syntax. Correct it like this:



          username=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1)


          And then do the same for the other variables too, which all have the same problem.



          Also, change the sudo useradd command like this:



          sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"


          Variables used in command line arguments should usually be double-quoted to avoid word splitting.






          share|improve this answer























          • Thanks for the help! It now returns the man page for useradd for some reason...
            – moltenmath
            1 hour ago










          • @moltenmath change the sudo command like this: sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name". I suspect it won't work either, but we will get a more meaningful error output.
            – janos
            1 hour ago










          • Edit: Nevermind, none of the users were added to groups
            – moltenmath
            1 hour ago








          • 1




            @moltenmath add an echo statement to see better what's happening, for example echo sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"
            – janos
            57 mins ago










          • Thanks for all the help @janos this thread can now be closed, is that a thing here?
            – moltenmath
            34 mins ago















          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          It seems you wanted to assign the result of the head ... command to the variable username here:




          username= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1 



          That is incorrect syntax. Correct it like this:



          username=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1)


          And then do the same for the other variables too, which all have the same problem.



          Also, change the sudo useradd command like this:



          sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"


          Variables used in command line arguments should usually be double-quoted to avoid word splitting.






          share|improve this answer














          It seems you wanted to assign the result of the head ... command to the variable username here:




          username= head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1 



          That is incorrect syntax. Correct it like this:



          username=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1)


          And then do the same for the other variables too, which all have the same problem.



          Also, change the sudo useradd command like this:



          sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"


          Variables used in command line arguments should usually be double-quoted to avoid word splitting.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 1 hour ago









          janos

          3,7061445




          3,7061445












          • Thanks for the help! It now returns the man page for useradd for some reason...
            – moltenmath
            1 hour ago










          • @moltenmath change the sudo command like this: sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name". I suspect it won't work either, but we will get a more meaningful error output.
            – janos
            1 hour ago










          • Edit: Nevermind, none of the users were added to groups
            – moltenmath
            1 hour ago








          • 1




            @moltenmath add an echo statement to see better what's happening, for example echo sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"
            – janos
            57 mins ago










          • Thanks for all the help @janos this thread can now be closed, is that a thing here?
            – moltenmath
            34 mins ago




















          • Thanks for the help! It now returns the man page for useradd for some reason...
            – moltenmath
            1 hour ago










          • @moltenmath change the sudo command like this: sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name". I suspect it won't work either, but we will get a more meaningful error output.
            – janos
            1 hour ago










          • Edit: Nevermind, none of the users were added to groups
            – moltenmath
            1 hour ago








          • 1




            @moltenmath add an echo statement to see better what's happening, for example echo sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"
            – janos
            57 mins ago










          • Thanks for all the help @janos this thread can now be closed, is that a thing here?
            – moltenmath
            34 mins ago


















          Thanks for the help! It now returns the man page for useradd for some reason...
          – moltenmath
          1 hour ago




          Thanks for the help! It now returns the man page for useradd for some reason...
          – moltenmath
          1 hour ago












          @moltenmath change the sudo command like this: sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name". I suspect it won't work either, but we will get a more meaningful error output.
          – janos
          1 hour ago




          @moltenmath change the sudo command like this: sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name". I suspect it won't work either, but we will get a more meaningful error output.
          – janos
          1 hour ago












          Edit: Nevermind, none of the users were added to groups
          – moltenmath
          1 hour ago






          Edit: Nevermind, none of the users were added to groups
          – moltenmath
          1 hour ago






          1




          1




          @moltenmath add an echo statement to see better what's happening, for example echo sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"
          – janos
          57 mins ago




          @moltenmath add an echo statement to see better what's happening, for example echo sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"
          – janos
          57 mins ago












          Thanks for all the help @janos this thread can now be closed, is that a thing here?
          – moltenmath
          34 mins ago






          Thanks for all the help @janos this thread can now be closed, is that a thing here?
          – moltenmath
          34 mins ago














          up vote
          0
          down vote













          The final code is this for anyone that is curious:



          #!/bin/bash

          counter=2

          while [ $counter -lt 19 ]
          do



          username=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1)
          psswd=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f2)
          full_name=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f3)
          group=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f4)
          second_group=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f5)

          sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"

          if [ "$second_group" = LPGestionnaires ]
          then
          sudo usermod -a -G LPGestionnaires "$username"
          fi

          echo "$username:$psswd" | sudo chpasswd

          ((counter++))
          done
          echo Execution complete





          share|improve this answer








          New contributor




          moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • You're almost re-inventing the newusers command here - at the very least, your script could be made somewhat neater by using a while loop (something like while IFS=';' read -r username passwd full_name group second_group; do stuff; done < ./user_sheet.csv)
            – steeldriver
            4 mins ago










          • @steeldriver I was just going to say something similar. For getting lines 2-19, I would use a sed command: done < <(sed -n '2,19 p' ./user_sheet.csv)
            – wjandrea
            1 min ago

















          up vote
          0
          down vote













          The final code is this for anyone that is curious:



          #!/bin/bash

          counter=2

          while [ $counter -lt 19 ]
          do



          username=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1)
          psswd=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f2)
          full_name=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f3)
          group=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f4)
          second_group=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f5)

          sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"

          if [ "$second_group" = LPGestionnaires ]
          then
          sudo usermod -a -G LPGestionnaires "$username"
          fi

          echo "$username:$psswd" | sudo chpasswd

          ((counter++))
          done
          echo Execution complete





          share|improve this answer








          New contributor




          moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • You're almost re-inventing the newusers command here - at the very least, your script could be made somewhat neater by using a while loop (something like while IFS=';' read -r username passwd full_name group second_group; do stuff; done < ./user_sheet.csv)
            – steeldriver
            4 mins ago










          • @steeldriver I was just going to say something similar. For getting lines 2-19, I would use a sed command: done < <(sed -n '2,19 p' ./user_sheet.csv)
            – wjandrea
            1 min ago















          up vote
          0
          down vote










          up vote
          0
          down vote









          The final code is this for anyone that is curious:



          #!/bin/bash

          counter=2

          while [ $counter -lt 19 ]
          do



          username=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1)
          psswd=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f2)
          full_name=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f3)
          group=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f4)
          second_group=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f5)

          sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"

          if [ "$second_group" = LPGestionnaires ]
          then
          sudo usermod -a -G LPGestionnaires "$username"
          fi

          echo "$username:$psswd" | sudo chpasswd

          ((counter++))
          done
          echo Execution complete





          share|improve this answer








          New contributor




          moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          The final code is this for anyone that is curious:



          #!/bin/bash

          counter=2

          while [ $counter -lt 19 ]
          do



          username=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f1)
          psswd=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f2)
          full_name=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f3)
          group=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f4)
          second_group=$(head -n $counter ./user_sheet.csv | tail -n 1 | cut -d ';' -f5)

          sudo useradd "$username" -m -g "$group" -s /bin/bash -c "$full_name"

          if [ "$second_group" = LPGestionnaires ]
          then
          sudo usermod -a -G LPGestionnaires "$username"
          fi

          echo "$username:$psswd" | sudo chpasswd

          ((counter++))
          done
          echo Execution complete






          share|improve this answer








          New contributor




          moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered 32 mins ago









          moltenmath

          83




          83




          New contributor




          moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          moltenmath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.












          • You're almost re-inventing the newusers command here - at the very least, your script could be made somewhat neater by using a while loop (something like while IFS=';' read -r username passwd full_name group second_group; do stuff; done < ./user_sheet.csv)
            – steeldriver
            4 mins ago










          • @steeldriver I was just going to say something similar. For getting lines 2-19, I would use a sed command: done < <(sed -n '2,19 p' ./user_sheet.csv)
            – wjandrea
            1 min ago




















          • You're almost re-inventing the newusers command here - at the very least, your script could be made somewhat neater by using a while loop (something like while IFS=';' read -r username passwd full_name group second_group; do stuff; done < ./user_sheet.csv)
            – steeldriver
            4 mins ago










          • @steeldriver I was just going to say something similar. For getting lines 2-19, I would use a sed command: done < <(sed -n '2,19 p' ./user_sheet.csv)
            – wjandrea
            1 min ago


















          You're almost re-inventing the newusers command here - at the very least, your script could be made somewhat neater by using a while loop (something like while IFS=';' read -r username passwd full_name group second_group; do stuff; done < ./user_sheet.csv)
          – steeldriver
          4 mins ago




          You're almost re-inventing the newusers command here - at the very least, your script could be made somewhat neater by using a while loop (something like while IFS=';' read -r username passwd full_name group second_group; do stuff; done < ./user_sheet.csv)
          – steeldriver
          4 mins ago












          @steeldriver I was just going to say something similar. For getting lines 2-19, I would use a sed command: done < <(sed -n '2,19 p' ./user_sheet.csv)
          – wjandrea
          1 min ago






          @steeldriver I was just going to say something similar. For getting lines 2-19, I would use a sed command: done < <(sed -n '2,19 p' ./user_sheet.csv)
          – wjandrea
          1 min ago












          moltenmath is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          moltenmath is a new contributor. Be nice, and check out our Code of Conduct.













          moltenmath is a new contributor. Be nice, and check out our Code of Conduct.












          moltenmath is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1102437%2fan-option-is-not-seeing-an-argument-that-is-a-variable-in-bash-please-help%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

          Eduardo VII do Reino Unido