English 中文(简体)
glob in Solaris csh
原标题:glob in solaris csh

我想列出从现在的目录开始的所有目录。 我不想把先前的名录(.)列入,因此我有的常规表述。 我正在使用sh子

ls .[^.]*

该公司在UNIX变量平台上进行罚款,但在太阳系中,我仍在使用这个薄子,但我只有目录。 我怎么能具体说明太阳系的确切功能 正式表述。 它用巴什开展工作,但我只需要使用sh子,因为保证能够在我们org的每个安全研究所盒子上找到。

最佳回答

You can do this with /bin/sh, but with a slightly different syntax; it uses ! rather than ^ to negate the set of characters:

ls .[!.]*

Note that this is a file matching pattern (a glob), not a regular expression.

但是,鉴于你在由各种炮弹支持的glob syntax中再次看到的变化,你可能最好使用<条码>grep,并使用实际的定期表述。

问题回答

www.un.org/Depts/DGACM/index_spanish.htm ow,我不知道他们仍然说: 页: 1 因此,我不知道太阳星号()。 cr:

ls `ls -a | grep  ^.[^.].* `

The -a for ls tells it to include all the dot-files in the list and then a bit of grep for dealing with the dots. That matches what ls .[^.]* does in OSX s csh, hopefully it will work with Solaris s as well.

Character classes in globs in csh don t support negation...

• 从太阳的人类网页上:

 [...] Match any single character in the enclosed list(s)  or
       range(s).  A  list is a string of characters.  A range
       is  two  characters  separated  by  a  dash  (-),  and
       includes  all  the  characters in between in the ASCII
       collating sequence (see ascii(5)).

因此,你可以创建一种特性类别,包括:40(空间)到(......之前的特性,从/到(其余可打印的正文)。

ls -a .[ --/-~]*

This seems to work for me, but I haven t checked the output with a fine-toothed comb.





相关问题
Portable way to get file size (in bytes) in the shell

On Linux, I use stat --format="%s" FILE, but the Solaris machine I have access to doesn t have the stat command. What should I use then? I m writing Bash scripts and can t really install any ...

Unix: fast remove directory for cleaning up daily builds

Is there a faster way to remove a directory then simply submitting rm -r -f *directory* ? I am asking this because our daily cross-platform builds are really huge (e.g. 4GB per build). So the ...

Startup time in Solaris server using shell script

How to find the start up time of a Solaris 5.1 server using a shell script,need to know how much time it took to be on running state?I need to know how much time it took to come to running mode from ...

Ruby 1.8.6 BigDecimal.to_f always returns 0,0 on Solaris

I have come across a very weird error. I m on Solaris 10, using Ruby Enterprise Edition (ruby 1.8.6 (2008-08-08 patchlevel 286) [i386-solaris2.10]) with Rails 2.3.4. I have a very weird error. In irb: ...

Where to set JDK to be used for SunOne server?

Where to set the JDK to be used by the SunOne server on Solaris? Is it all configured via an environment variable like JDK_HOME or JAVA_HOME, or is there a config file for the SunOne server somewhere ...

热门标签