ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Find the character break - sh script

    IT Discussion
    osx apple shell shell scripting error
    4
    28
    2.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403 @1337
      last edited by

      @pete-s except that isn't the issue, as I can run the individual command without any interference.

      1 1 Reply Last reply Reply Quote 0
      • 1
        1337 @DustinB3403
        last edited by 1337

        @DustinB3403 said in Find the character break - sh script:

        @pete-s except that isn't the issue, as I can run the individual command without any interference.

        Your output seems garbled but the first error is "command not found". If you get it on the second line then the first line is where the error is. Command not found is usually a problem with the directory or the path.

        Try enable debugging on the bash script. http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html
        Makes it easier to see when and where the error/problem is.

        PS.I'm talking about softwareupdate where you get the error. It's bash script right?

        DustinB3403D 1 Reply Last reply Reply Quote 0
        • DustinB3403D
          DustinB3403 @1337
          last edited by

          @Pete-S yeah, the software update command has worked on 7 other systems.

          1 Reply Last reply Reply Quote 0
          • M
            marcinozga
            last edited by

            Remove / at the end of dockutil lines. Is there any chance this script was written on Windows machine? Perhaps EOL needs converting from Windows CR LF to unix LF.

            What happens if you change shebang to /bin/bash?

            DustinB3403D 1 Reply Last reply Reply Quote 1
            • DustinB3403D
              DustinB3403 @marcinozga
              last edited by

              @marcinozga I was actually considering just rewritting the entire thing on a Apple computer for good measure.

              I'll remove the / at the ends of the lines, but those were from autocomplete in apple terminal.

              M 1 Reply Last reply Reply Quote 0
              • M
                marcinozga @DustinB3403
                last edited by

                @DustinB3403 I'd try eliminating the problem line by line, or at least by sections. You also have admin user listed twice in kickstart line, fix that too.

                DustinB3403D 1 Reply Last reply Reply Quote 0
                • DustinB3403D
                  DustinB3403 @marcinozga
                  last edited by

                  @marcinozga that is to apply the user account that I want to have local admin rights 🙂

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    marcinozga @DustinB3403
                    last edited by

                    @DustinB3403 but why do you have admin there twice? It's a list of users, separated by comma, what you're doing is setting privileges for admin user, and then for admin user again. It doesn't make much sense.

                    1 Reply Last reply Reply Quote 0
                    • DustinB3403D
                      DustinB3403
                      last edited by

                      Seems to be something with the if statement. Now I just need to figure out what since I haven't touched this part of the script at all. . .

                      Stupid Apple!

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        marcinozga @DustinB3403
                        last edited by

                        @DustinB3403 I just ran that if part of the script, and it runs fine.

                        DustinB3403D 1 Reply Last reply Reply Quote 1
                        • DustinB3403D
                          DustinB3403 @marcinozga
                          last edited by

                          @marcinozga ugh. .

                          When I removed it from the script, the rest of the script at least ran. So now I'm back to square one. . .

                          M 1 Reply Last reply Reply Quote 0
                          • M
                            marcinozga @DustinB3403
                            last edited by

                            @DustinB3403 Ok, script fails because brew installation is waiting for input. If you run it directly, it'll ask you to press return to continue. Try changing it like so:

                            ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" </dev/null
                            
                            1 Reply Last reply Reply Quote 0
                            • DustinB3403D
                              DustinB3403
                              last edited by

                              OKAY so I've gone back to the basics at this point and I'm just writing the script over again. @marcinozga thanks for the assistance the 111</dev/null``` doesn't appear to make a difference.

                              1 Reply Last reply Reply Quote 0
                              • DustinB3403D
                                DustinB3403
                                last edited by DustinB3403

                                OK so while the script works, I'm now hitting the GitHUB API limit.

                                According to homebrew I should be able to authenticate with

                                HOMEBREW_GITHUB_API_TOKEN: A personal access token for the GitHub API, which you can create at https://github.com/settings/tokens. If set, GitHub will allow you a greater number of API requests. See https://developer.github.com/v3/#rate-limiting for more information. Homebrew uses the GitHub API for features such as brew search.
                                

                                so performing echo `export $HOMEBREW_GITHUB_API_TOKEN=XXXXXXXXXXX` >> ~/.bash_profile

                                Should work, but doesn't appear to. Obviously I have something wrong here.

                                M 1 Reply Last reply Reply Quote 0
                                • M
                                  marcinozga @DustinB3403
                                  last edited by

                                  @DustinB3403 you need to source .bash_profile after changing it, so bash picks up modified file. Either

                                  source ~/.bash_profile

                                  or

                                  . ~/.bash_profile

                                  DustinB3403D 1 Reply Last reply Reply Quote 2
                                  • DustinB3403D
                                    DustinB3403 @marcinozga
                                    last edited by

                                    @marcinozga said in Find the character break - sh script:

                                    @DustinB3403 you need to source .bash_profile after changing it, so bash picks up modified file. Either

                                    source ~/.bash_profile

                                    or

                                    . ~/.bash_profile

                                    Thanks for that, I was actually sorting out that bit as you posted.

                                    Short of setting up a few printers via the script I'm back in working order.

                                    1 Reply Last reply Reply Quote 0
                                    • 1
                                    • 2
                                    • 2 / 2
                                    • First post
                                      Last post