get the interpreting shell Some of my shell scripts need to invoke a new shell (e.g. when using lockf(1) ). To get the interpreting shell, I use: interpreter="$(ps -o command -p $$ | tail -n1 | sed "s, $0${*:+ $*}\$,,1")" This will yield whatever shell I used to invoke the script on FreeBSD, e.g. "/bin/sh -f" or "bash". I wonder whet... 23 Feb 2010 13:33
what's the difference between cc and gcc $ gcc -D_GNU_SOURCE -Wall -Wextra e5.c -o out $ $ cc -D_GNU_SOURCE -Wall -Wextra e5.c -o out $ ./out path_max is 4096 name_max is 255 buf_size is 4353 $ Since having started to use gnu development tools on windows, I would always type the former. I'd see cc, but didn't think it would do me any good.... 26 Feb 2010 05:15
Comparing with string "$end" in tcsh Hi, I was trying to compare if the last lline of a file is $end in tcsh. I tried this: ###################### set string1 = `cat file|tail -1` set string2 = "\$end" if (string1 != string2) then echo "Not matching" endif ##################### But shell doesn't allow to compare "$end"[I tries adding t... 24 Feb 2010 21:05
How to merge these two files? Hi, I have one CSV file with three columns of data ... "COL1","Col2","col3" and I have another file with only a single column of data. col4 How do I create a combined file where each row of the second file is appended onto each row of the first file, forming something like "COL1","Col2","col3",col4 ... 22 Feb 2010 18:41
awk: is it possible to use some charcters' combination as thefield-separator? On 2/21/2010 7:57 PM, Hongyi Zhao wrote: Hi all, Consider the following sentence: you're my friend, bla, he's my another friend. If I want to use the bla as the awk's field-separator to do some text manipulate, is it possible or not? Why not try it and see? It'd be faster than typing and post... 22 Feb 2010 09:36
Fun with the $SHELL Hi ! I was just wondering wether somebody wants to share his/her best shell script snippets here on the list. Im interested in everything that can do something nifty to a system or a website. Pick your favourite shell wether its bash,sh,dash,ksh,csh,fish or whatever just have fun hacking and share your jewel... 25 Feb 2010 19:23
awk: is it possible to use some charcters' combination as the field-separator? Hi all, Consider the following sentence: you're my friend, bla, he's my another friend. If I want to use the bla as the awk's field-separator to do some text manipulate, is it possible or not? -- ..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. ... 21 Feb 2010 22:43
awk: use { or } as the field-separator. Hi all, I've some text like the following: 80mm]{level.pdf}% Here is how to import EPS art 80mm]{p1.pdf}} 80mm]{p2.pdf}} 80mm]{method1.pdf}} 80mm]{method2.pdf}} 80mm]{method1-calculation}} 80mm]{method2-calculation}} I want to extract the contents among the {} in the above snippet, so I use the followin... 25 Feb 2010 13:40
POSIX Shell and Parameter Expansion I'm interested in construction like ${x:-} Is it a correct shell token? Judging from this document http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html section 2.6.2 this is not correct since the word after ":-" is not optional. (Compare with ":?" where the word is optional.) But shell impl... 25 Feb 2010 19:23
copy a filesystem and preserve hard links on Linux Hi everybody, When using "cp", the hard links are not preserved. I have found the following discussion: http://jeremy.zawodny.com/blog/archives/010037.html Some comments in this page claim that "cp -av --preserve=all" works. I do not agree with that (see the example below). Can you confirm that cp does no... 21 Feb 2010 12:38 |