<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Rick,<br>
<br>
This is very interesting. I did not know either that there is a dash
shell in ubuntu?! <br>
But you figured it out. And now the script works. Great! <br>
<br>
I'll contact the author of the packages, perhaps he can add this
behaviour to the "known issues".<br>
<br>
Thanks a lot!<br>
Matthias<br>
<br>
<div class="moz-cite-prefix">On 10/02/17 22:05, Rick Brownrigg
wrote:<br>
</div>
<blockquote
cite="mid:CAGKRhbHb2O-KV_=mFL+Jhs7GZovnRHtaQKJLx6qd_sTaETJEqw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>Hi Matthias,<br>
<br>
</div>
I think maybe we have explaination. The so-called
"brace-expansion" appears to be a bash thing. I
speculate your shell in your terminal window is indeed
bash. However, by default, NCL under the covers
invokes "/bin/sh" during the systemfunc() call. On
many Linux systems, /bin/sh is simply a symlink to
bash (that's the case on my system and why things work
for me). However, apparently on Ubuntu systems,
/bin/sh is a symlink to a shell called "dash" (I'd
never heard of it), and dash is the one that does not
understand brace-expansion -- you can try it yourself
by invoking "dash" on the command-line and then trying
a command that involves brace-expansion. More on this
here:<br>
<br>
<a moz-do-not-send="true"
href="http://askubuntu.com/questions/87853/what-is-default-shell-for-terminal">http://askubuntu.com/questions/87853/what-is-default-shell-for-terminal</a><br>
<br>
</div>
So a solution in your case would be something like this:<br>
<br>
</div>
files = systemfunc("bash -c 'ls
/DIRECTORY/*{.nc,.hdf,.pdf}'")<br>
<br>
</div>
In particular note the "-c" switch to bash, and that the
command you want bash to execute is surrounded by
single-quotes.<br>
<br>
</div>
Hope that helps...<br>
</div>
Rick<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Feb 10, 2017 at 12:54 PM,
Matthias Demuzere <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:Matthias.Demuzere@ugent.be" target="_blank">Matthias.Demuzere@ugent.be</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="auto">Hi Rick,
<div dir="auto"><br>
</div>
<div dir="auto">Yes... I tested this for a single string
without curly brackets (eg. *.nc) and that works fine
...</div>
<div dir="auto">Does this indicate there is somehow a
system dependency, even though the curly brackets do
work directly in the terminal? Quite puzzling, no?</div>
<span class="HOEnZb"><font color="#888888">
<div dir="auto"><br>
</div>
<div dir="auto">Matthias</div>
</font></span></div>
<div>
<div class="h5">
<div class="gmail_extra"><br>
<div class="gmail_quote">On 10 Feb 2017 18:30, Rick
Brownrigg <<a moz-do-not-send="true"
href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>>
wrote:<br type="attribution">
<blockquote class="m_4585874273660185032quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div>
<div dir="ltr">
<div>
<div>Hi Matthias,<br>
<br>
</div>
That is very odd -- it works for me, both
at bash command line and using
systemfunc() from within NCL. Can you get
systemfunc to return files from a
directory without using "{}" notation,
.i.e, "ls *" for example? Or simply "ls
foo" where the file foo is known to exist
in the current directory?<br>
<br>
</div>
Rick<br>
</div>
<div><br>
<div
class="m_4585874273660185032elided-text">On
Fri, Feb 10, 2017 at 10:15 AM, Matthias
Demuzere <span dir="ltr">
<<a moz-do-not-send="true"
href="mailto:matthias.demuzere@ugent.be"
target="_blank">matthias.demuzere@ugent.be</a>></span>
wrote:<br>
<blockquote style="margin:0 0 0
0.8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div>Dear all,<br>
<br>
I am currently testing the CVDP (<a
moz-do-not-send="true"
href="http://www.cesm.ucar.edu/working_groups/CVC/cvdp/"
target="_blank">http://www.cesm.ucar.edu/work<wbr>ing_groups/CVC/cvdp/</a>)
which is written in ncl.<br>
Currently the software does not run
because it can't find the proper
datasets. <br>
<br>
Finding the data is driven by the <b>systemfunc</b>
command using curly brackets (multiple
options).<br>
For example, within ncl, I want to
list all files that have one of the
following extension: .nc, .hdf, .pdf.<br>
<br>
This I do with:<br>
myFiles = systemfunc("ls
/DIRECTORY/*{.nc,.hdf,.pdf}")<br>
<br>
If I fo this in ncl, I get an error:
ls: cannot access
'/DIRECTORY/*{.nc,.hdf,.pdf}': No such
file or directory<br>
<br>
Yet, when pasting ls
/DIRECTORY/*{.nc,.hdf,.pdf} directly
in my system (ubuntu 16.04, 64bit)
terminal, I do get a list of the
finals with this extension. So the
expected result.<br>
<br>
I have tested this in ncl-6.3.0 and
6.2.1, but I have the same problem in
both.<br>
Did anyone else notice this before?
Any idea on how to fix this?<br>
<br>
Thanks!<br>
<br>
Regards,<br>
Matthias<br>
<br>
<br>
<pre>--
Post-doctoral Research Fellow
_____________________________
UGent [Home]
Department of Forest and Water Management
Laboratory for Hydrology and Water Management
Coupure links 653, B-9000 Ghent, Belgium
Email: <a moz-do-not-send="true" href="mailto:Matthias.demuzere@UGent.be" target="_blank">Matthias.demuzere@UGent.be</a>
Web: <a moz-do-not-send="true" href="http://www.ugent.be/bw/dfwm/en/research/LHWM/staff/matthias" target="_blank">http://www.ugent.be/bw/dfwm/en<wbr>/research/LHWM/staff/matthias</a>
KU Leuven [Affiliated]
Department of Earth & Environmental Sciences
Division of Geography and Tourism / Regional climate studies
Celestijnenlaan 200E, B-3001 Heverlee (Leuven), Belgium
Email: <a moz-do-not-send="true" href="mailto:matthias.demuzere@kuleuven.be" target="_blank">matthias.demuzere@kuleuven.be</a>
Web: <a moz-do-not-send="true" href="https://ees.kuleuven.be/geography/rcs" target="_blank">https://ees.kuleuven.be/geogra<wbr>phy/rcs</a></pre>
</div>
______________________________<wbr>_________________
ncl-talk mailing list
<a moz-do-not-send="true" href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>
List instructions, subscriber options, unsubscribe:
<a moz-do-not-send="true" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div></div></div>
</blockquote></div>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
Post-doctoral Research Fellow
_____________________________
UGent [Home]
Department of Forest and Water Management
Laboratory for Hydrology and Water Management
Coupure links 653, B-9000 Ghent, Belgium
Email: <a class="moz-txt-link-abbreviated" href="mailto:Matthias.demuzere@UGent.be">Matthias.demuzere@UGent.be</a>
Web: <a class="moz-txt-link-freetext" href="http://www.ugent.be/bw/dfwm/en/research/LHWM/staff/matthias">http://www.ugent.be/bw/dfwm/en/research/LHWM/staff/matthias</a>
KU Leuven [Affiliated]
Department of Earth & Environmental Sciences
Division of Geography and Tourism / Regional climate studies
Celestijnenlaan 200E, B-3001 Heverlee (Leuven), Belgium
Email: <a class="moz-txt-link-abbreviated" href="mailto:matthias.demuzere@kuleuven.be">matthias.demuzere@kuleuven.be</a>
Web: <a class="moz-txt-link-freetext" href="https://ees.kuleuven.be/geography/rcs">https://ees.kuleuven.be/geography/rcs</a></pre></body></html>