microsoft / shell-intune-samples

Sample shell scripts for Intune admins.
MIT License
637 stars 213 forks source link

Unexpected token #51

Closed mgdmdz closed 2 years ago

mgdmdz commented 2 years ago
Install Acrobat.sh: line 770: syntax error near unexpected token `>'
Install Acrobat.sh: line 770: `    exec &> >(tee -a "$log")'

please tell me what I'm doing wrong because I'm sure I am :) Running on Catalina.

InsulT commented 2 years ago

I am having the same issue :( Running Monterey

theneiljohnson commented 2 years ago

Can you send me the complete log please? I've just tested and it seems fine for me. Are you downloading and running on macOS or editing in Windows first?

InsulT commented 2 years ago

Running via Intune seems to be working. Ye I edited it on Windows and copied over the script using one drive. syntax error near unexpected token >' exec &> >(tee -a "$log")'

This is all I receive as an error, no logs generated.

Edit: Just tried to copy paste your code to my macbook directly and getting the same errors.

mgdmdz commented 2 years ago

Can you send me the complete log please? I've just tested and it seems fine for me. Are you downloading and running on macOS or editing in Windows first?

no logs, just this error. Failed via Intune as well. . Just says "script failed to run". Ran on macOS directly as well.

theneiljohnson commented 2 years ago

Can one of you send me a link to the precise code that you are running please? I can't find any reference of 'Install Acrobat.sh' anywhere in the repo.

mgdmdz commented 2 years ago

Can one of you send me a link to the precise code that you are running please? I can't find any reference of 'Install Acrobat.sh' anywhere in the repo.

i have just renamed the script for my liking. Could this be a problem? That's the only change.

mgdmdz commented 2 years ago

Can one of you send me a link to the precise code that you are running please? I can't find any reference of 'Install Acrobat.sh' anywhere in the repo.

nope, still the same error even when keeping the old name,

mgdmdz commented 2 years ago

AcroInstall.txt

theneiljohnson commented 2 years ago

There is a sample specifically for Acrobat Reader here : https://github.com/microsoft/shell-intune-samples/tree/master/Apps/AdobeAcrobatReaderDC

mgdmdz commented 2 years ago

There is a sample specifically for Acrobat Reader here : https://github.com/microsoft/shell-intune-samples/tree/master/Apps/AdobeAcrobatReaderDC

i downloaded the RAW before. Should I do something differently?

theneiljohnson commented 2 years ago

Right click where it says 'RAW', select save-as and save locally, then run chmod +x, then run the script with sudo on the Mac. Try to avoid editing Mac shell scripts on Windows if you can.

theneiljohnson commented 2 years ago

I've also removed some of the older samples, you should be using 3.0.6 from here https://github.com/microsoft/shell-intune-samples/blob/master/Apps/LatestSampleScript/installIntuneApp3.06.sh

mgdmdz commented 2 years ago

I've also removed some of the older samples, you should be using 3.0.6 from here https://github.com/microsoft/shell-intune-samples/blob/master/Apps/LatestSampleScript/installIntuneApp3.06.sh

still the same error unfortunately. Install Acrobat.sh: line 770: syntax error near unexpected token >' Install Acrobat.sh: line 770: exec &> >(tee -a "$log")'

theneiljohnson commented 2 years ago

I've literally just updated this and checked on three machines, so the code is fine : https://github.com/microsoft/shell-intune-samples/tree/master/Apps/AdobeAcrobatReaderDC

How are you running it?

mgdmdz commented 2 years ago

From terminal directly: error as above. From Intune- error "Script failed to run". What am I missing?

theneiljohnson commented 2 years ago

I'm honestly a bit lost as to what you're doing wrong. When you say 'directly from terminal' can you tell me precisely what you're typing in terminal?

mgdmdz commented 2 years ago

sudo sh installAcrobatDC.sh also tried without sudo

theneiljohnson commented 2 years ago

Ahh, try sudo ./installAcrobatDC.sh the sh is calling the default shell which is ZSH.

mgdmdz commented 2 years ago

Ahh, try sudo ./installAcrobatDC.sh the sh is calling the default shell which is ZSH.

NIIIIIIICE! Thank you very much friend, turns out it was a simple shell case. Thanks again.

theneiljohnson commented 2 years ago

No worries and really sorry it took so long to figure out!