eg.
me$ FOO="BAR * BAR"
me$ echo $FOO
BAR file1 file2 file3 file4 BAR
and using the "\" escape character:
me$ FOO="BAR \* BAR"
me$ echo $FOO
BAR \* BAR
I'm obviously doing something stupid.
How do I get the output "BAR * BAR" ?
...
When you pipe two process and kill the one at the "output" of the pipe, the first process used to receive the "Broken Pipe" signal, which usually terminated it aswell. E.g. running
$> do_something_intensive | less
and then exiting less used to return you immediately to a responsive shell, on a SuSE8 or former releases.
when i'm trying...
I've been working on an embedded C/C++ project recently using the shell in Tornado 2 as a way of debugging what's going on in our kit. The only problem with this approach is that it's a complicated system and as a result, has a fair bit of output. Tornado 'helpfully' scrolls the window every time some new information arrives which means ...
On Mac OS X, you can create a zip archive from the Finder by selecting some files and selecting "Compress" from the contextual menu or the File menu. Unfortunately, the resulting file is not identical to the archive created by the zip command (with the default options).
This distinction matters to at least one service operated by Apple...
The one-liner should:
solve a real-world problem
not be extensively cryptic (should be easy to understand and reproduce)
be worth the time it takes to write it (should not be too clever)
I'm looking for practical tips and tricks (complementary examples for perldoc perlrun).
...
In terms of quick dynamically typed languages, I'm really starting to like Javascript, as I use it a lot for web projects, especially because it uses the same syntax as Actionscript (flash).
It would be an ideal language for shell scripting, making it easier to move code from the front and back end of a site, and less of the strange syn...
I like to use Emacs' shell mode, but it has a few deficiencies. One of those is that it's not smart enough to open a new buffer when a shell command tries to invoke an editor. For example with the environment variable VISUAL set to vim I get the following from svn propedit:
$ svn propedit svn:externals .
"svn-prop.tmp" 2L, 149C[1;1H
~...
What's the best way for a running C or C++ program that's been launched from the command line to put itself into the background, equivalent to if the user had launched from the unix shell with '&' at the end of the command? (But the user didn't.) It's a GUI app and doesn't need any shell I/O, so there's no reason to tie up the shell af...
I have this line in a useful Bash script that I haven't managed to translate into Python, where 'a' is a user-input number of days' worth of files to archive:
find ~/podcasts/current -mindepth 2 -mtime '+`a`+' -exec mv {} ~/podcasts/old \;
I am familiar with the os.name and getpass.getuser for the most general cross-platform elements....
Before moving on to use SVN, I used to manage my project by simply keeping a /develop/ directory and editing and testing files there, then moving them to the /main/ directory. When I decided to move to SVN, I needed to be sure that the directories were indeed in sync.
So, what is a good way to write a shell script [ bash ] to recursivel...
Specifically I have a PHP command-line script that at a certain point requires input from the user. I would like to be able to execute an external editor (such as vi), and wait for the editor to finish execution before resuming the script.
My basic idea was to use a temporary file to do the editing in, and to retrieve the contents of th...
I have a server access log, with timestamps of each http request, I'd like to obtain a count of the number of requests at each second. Using sed, and cut -c, so far I've managed to cut the file down to just the timestamps, such as:
22-Sep-2008 20:00:21 +0000
22-Sep-2008 20:00:22 +0000
22-Sep-2008 20:00:22 +0000
22-Sep-2008 20:0...
I'm sure there's some trivial one-liner with perl, ruby, bash whatever that would let me run a command in a loop until I observe some string in stdout, then stop. Ideally, I'd like to capture stdout as well, but if it's going to console, that might be enough.
The particular environment in question at the moment is RedHat Linux but ne...
here is my directory structure.
/user/a
/user/b
/user/b
inside folder a,b,c there is a file person.java (it is the Same file, just a one line modification.
now, on my shell, im on my /user/ directory and i try to do
javac */person.java
the shell returns the following error,
person.java:14: duplicate class: person
Is there any...
What happens if I use HGetFolderPath api call in a 32 bit system with CSIDL_PROGRAM_FILESx86 folder id, instead of the CSIDL_PROGRAM_FILES id ?
Theoretically CSIDL_PROGRAM_FILESx86 should map to C:\program files (x86) in a 64 bit system but what does it map to in a 32 bit system where this path doesn't exists?
Thanks in advanced.
...
I have two (UNIX) programs A and B that read and write from stdin/stdout.
My first problem is how to connect the stdout of A to stdin of B and the stdout of B to the stdin of A. I.e., something like A | B but a bidirectional pipe. I suspect I could solve this by using exec to redirect but I could not get it to work. The programs are int...
Hi,
How do I tar a list of files and folders (all in the same directory) with the exclusion of a single directory (which contains a huge amount of data)
...
Okay, I'm sure this is simple but it is driving me nuts. I recently went to work on a program where I've had to step back in time a bit and use Redhat 9. When I'm typing on the command line from a standard xterm running Korn shell, when I reach the end of the line the screen slides to the right (cutting off the left side of my command) i...
I'm processing a huge file with (GNU) awk, (other available tools are: Linux shell tools, some old (>5.0) version of Perl, but can't install modules).
My problem: if some field1, field2, field3 contain X, Y, Z I must search for a file in another directory which contains field4, and field5 on one line, and insert some data from the found...
I basically want to do this:
grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log
...with of course the filename being example.com.2008-09-27-11:21:30.log
I'd then put this in crontab to run daily.
...