Re: Files not found




"John" <nyrinwi@xxxxxxxxx> wrote in message
news:47d435b1$0$24105$4c368faf@xxxxxxxxxxxxxxxxx
Leslie Rhorer wrote:
"John" <nyrinwi@xxxxxxxxx> wrote in message
news:47d2a3e5$0$4968$4c368faf@xxxxxxxxxxxxxxxxx
files=$(find ./ -cmin -5 -print)

or if you prefer an array...

files=($(find ./ -cmin -5 -print))

You can then take whatever action you like; e.g.

if [ ${#files} -eq 0 ]; then ... # non array

I tried this, and it doesn't work, either. It gives me an error, saying:

./Videoscribe: line 23: unexpected EOF while looking for matching `)'

Line 23 is the if [ ${#files} -eq 0 ] statement.

Then it says:

./Videoscribe: line 33: syntax error: unexpected end of file

The script Videoscribe only has 32 lines.

If I remove the if [ ${#files} -eq 0 ]; then ... fi section, the errors
disappear.

Other than as a comment delimiter, I am not familiar with the use of #
within an evaluation expression. What does it do?
Sounds like your cron job is running with strict Bourne shell
compatibility, so you're not getting Bash extensions.

${#var} gives the length of a variable in chars. It's a Bash feature.

${#var[@]} gives the length of an array - also a Bash feature.


Make sure your script begins with #!/bin/sh, or #!/bin/bash

I never said it was a cron script, but more to the point the script does
begin with #!/bin/bash.

The problem was parentheses vs. braces. I couldn't tell the characters in
your script line were braces, not parentheses. (My eyes are getting a bit
old.) A cut and paste would have prevented the error, but unfortunately the
Linux system doesn't have a news reader configured, so I was copying the
text by hand. Once I changed if [ $(#files) -eq 0 ]; to if [ ${#files} -eq
0 ]; it all worked.



.



Relevant Pages

  • Re: [PATCH] Speed up "make headers_*"
    ... 'use strict' and 'use warnings' is recommended. ... The parentheses are not needed for most of the built-in functions. ... More or less the same comments would apply to the next script as well. ...
    (Linux-Kernel)
  • Re: Trailing blanks in batch file
    ... Same applies to parentheses and quotes, ... problem as there *being* a trailing space whose presence creates a problem. ... If someone exclusively used an editor that displayed blanks as grey dots, ... can never be sure that one's script will never be edited by someone else ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: make 100 by using 1, 7, 7, 7, 7
    ... Here is a Perl script that prints out all balanced strings ... The balanced strings of 2n parentheses ... can be bijected with the binary trees on n vertices. ...
    (sci.math)
  • Re: COM - ADSI & PHP
    ... This script works fine querying most distinguishedName values. ... I keep running into a problem is with a specific OU that has braces ... I know that the LDAP functions in PHP may be able to help but the ... Did you escape the characters with a backslash, or did you use the hex ...
    (alt.php)
  • Re: {} is sed programs (Was: Re: Standard output piping problem)
    ... >>I won't bother with them in future then. ... > compound statements) enclosed in curly braces. ... I had to modify the script by moving the final brace to a newline, ...
    (comp.unix.shell)