Tuesday, November 19, 2019

#1 2019-10-14 06:23:36 am

PierreScerri
Member
Registered: 2010-11-30
Posts: 22

fgrep hanging??

Hi

I've had this code running for quite a while now, until recently it started to hang at the fgrep script and eventually timeout.

It must have started after I upgraded to macOS Catalina.

The file Daily.CSV is a spreadsheet on a samba share on a Raspberry Pi.  I can access this file from my Mac.

The 'search' variable is set to a date.  I have put in a specific date for this example.
The script gets the line that contains that date.

Running the fgrep command from the Mac terminal works.

Can't see what is holding it up.

Applescript:

tell application "AppleScript Utility"
   set DailyCSV to "/Volumes/config/readings/Daily.csv"
   set search to "2019 Oct 12"
   do shell script "fgrep '" & search & "' " & DailyCSV
end tell

Last edited by PierreScerri (2019-10-14 06:33:28 am)

Offline

 

#2 2019-10-14 05:20:32 pm

Marc Anthony
Member
From:: Dallas, TX
Registered: 2006-04-27
Posts: 907

Re: fgrep hanging??

Hi, Pierre. Shell scripts shouldn't reside within tell blocks. I would quote the search term, as it contains spaces.

Applescript:

do shell script "fgrep " & "2019 Oct 12"'s quoted form & space & "/Volumes/config/readings/Daily.csv"

Offline

 

#3 2019-10-15 02:56:15 am

PierreScerri
Member
Registered: 2010-11-30
Posts: 22

Re: fgrep hanging??

HI

Thank you for that.  Problem solved.

How come it was working before?

Offline

 

#4 2019-10-15 04:59:18 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6034

Re: fgrep hanging??

AppleScript used to silently error and then redirect the command. I haven't checked, but perhaps the redirection no longer occurs.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#5 2019-10-16 01:42:49 am

PierreScerri
Member
Registered: 2010-11-30
Posts: 22

Re: fgrep hanging??

Hi

Tried it again this morning and it's not working.

Strange

Last edited by PierreScerri (2019-10-16 08:34:04 am)

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)