Is the shell’s `source` POSIX-standard?
It’s there under “dot”. NAME dot – execute commands in the current environment SYNOPSIS . file [etc.]
It’s there under “dot”. NAME dot – execute commands in the current environment SYNOPSIS . file [etc.]
You can set LC_COLLATE to traditional sort order just for your command: env LC_COLLATE=C sort tmp This won’t change the current environment just the one in which the sort command executes. You should have the same behaviour with this.
Ksh93 (or bash) doesn’t have such expressions, so it’s better to make it explicit. But you can bundle multiple variables (with their initial values) in a single export phrase: export A=1 B=2 C=3 Testing: $ (export A=1 B=2 C=3 && ksh -c ‘echo A=$A B=$B C=$C D=$D’) A=1 B=2 C=3 D= Awkward alternatives There is … Read more
The regular expression to match the end of the line is $, not \n (since grep works a line at a time, it ignores the newlines between lines). grep -c ‘^$’ myfile.txt
There is no difference if you do not put $* or $@ in quotes. But if you put them inside quotes (which you should, as a general good practice), then $@ will pass your parameters as separate parameters, whereas $* will just pass all params as a single parameter. Take these scripts (foo.sh and bar.sh) … Read more
The C standard dictates what each library function must do rather than how it is implemented. Almost all known implementations of C are compiled into machine language. It is up to the implementers of the C compiler/library how they choose to implement functions like strlen. They could choose to implement it in C and compile … Read more
Check out this question. Use… String home = System.getProperty(“user.home”); File file = new File(home+”/Downloads/” + fileName + “.txt”);
Yes, you can access a gzip file randomly by reading the entire thing sequentially once and building an index. See examples/zran.c in the zlib distribution. If you are in control of creating the gzip file, then you can optimize the file for this purpose by building in random access entry points and construct the index … Read more
Directories need the execute permission set in order to see their contents. From http://content.hccfl.edu/pollock/AUnix1/FilePermissions.htm You can think of read and execute on directories this way: directories are data files that hold two pieces of information for each file within, the file’s name and it’s inode number. Read permission is needed to access the names of … Read more