Sponsored Content
Top Forums Shell Programming and Scripting Shell quoting rules for other languages programmers Post 302715553 by wyderkat on Monday 15th of October 2012 05:44:29 AM
Old 10-15-2012
Shell quoting rules for other languages programmers

I've seen so many times that programmers were confused about shell quoting and white spaces interpretation, that I decided to investigate that problem deeper. And my conclusion is that quoting in shells is very different from other programming languages. Programmers who have bigger experience in C/Python/Java/PHP than in Shell should remember about two unintuitive rules:
  • everything in shell is a string, and one need to quote everything properly. Also when reading variables: "$X", not only storing X="hi there"
  • shell will parse lines of code just one time, leaving unresolved nested variables and commands. In this case programmer need to explicitly use "eval" function.

I've written short article about this if anyone will be more curious you can find it under "white shell cofoh"
This User Gave Thanks to wyderkat For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Shell scripting & programming languages

If I want to do high-end 3d animation, what skell scripting languages, and programming languages shoul I learn? If you know any good resources for learning these languages they would be appreciated. (1 Reply)
Discussion started by: aloysius1001
1 Replies

2. UNIX for Advanced & Expert Users

Perl - Programmers manual online?

I have never programmed in Perl (insert laughter, mock, etc. here ____) - so I need a sort of "Programming in Perl" covering the basics. I now have two Perl books, one is a 5 volume Unix resource kit, the other is "Mastering algorithms with Perl" - none of them explains how to produce "hello,... (11 Replies)
Discussion started by: AtleRamsli
11 Replies

3. News, Links, Events and Announcements

Good Essays For Programmers

Check the essays out. http://www.paulgraham.com (0 Replies)
Discussion started by: photon
0 Replies

4. What is on Your Mind?

Suggested venues to look for advanced C programmers

Can someone suggest any online venues to assist in recruiting a senior C programmer (looking for someone interested in working on kerberos code). I've tried a bunch of the open source and higher ed lists (this is for Univ. of Michigan). The commercial services such as Dice or monster yield a... (7 Replies)
Discussion started by: painman
7 Replies

5. What is on Your Mind?

Programming languages polyglots: how many languages you know?

Post what languages (including scripting) you know, why and where you think that language is most usable. Also include libraries in which you're really good at (libusb, gtk, qt, etc). assembly? C or C++? perl or python? pascal? bash or csh/tcsh? opengl? gtk or qt? mono? (27 Replies)
Discussion started by: redoubtable
27 Replies

6. Shell Programming and Scripting

Shell quoting problem while editing a remote file using sed

value of i = solarisbox ssh $i "cat /etc/hosts | sed "s/$i\.local\.//" | sed "s/$i\./$i/" | sed "s/$i/$i.sol.com/" > /usr/users/chidori/edit_hosts"While running the above one liner its i am not able to make the changes and write it to the file /usr/users/chidori/edit_hosts . I know there is a... (2 Replies)
Discussion started by: chidori
2 Replies

7. Programming

Hello UNIX programmers

i have MOTIF installed X11 a easy program is saved as hello.c there is the following message where can i get the X11/intrinsic.h , file ??? need help to compile my system : MX-16 Linux Debian Jessie / i386 hans@mx1:~/Documents $ cc push.c -o push -lXm -lXt -lX11 In file included from... (0 Replies)
Discussion started by: Zabo
0 Replies

8. Forum Support Area for Unregistered Users & Account Problems

Trojan is detected when I visit Programmers forum

When I visit Programmers forum my ESET Nod32 detects TrojanDownloader.Pegel.BH.trojan I don't know when it started, as I visited the site today after staying off-line a few days. (2 Replies)
Discussion started by: migurus
2 Replies

9. What is on Your Mind?

Multics Systems Programmers Manual as of 1969-04-01, comprising 996 PDF Files

While working on my current "UNIX history project" I ran across this: Jerry Saltzer created an online scanned copy of the Multics Systems Programmers' Manual (MSPM) in this directory. Based on the 1969-04-01 MSPM, the repo comprising 996 PDF files. In order to help preserver the MSPM, ... (1 Reply)
Discussion started by: Neo
1 Replies

10. What is on Your Mind?

The poorest of computer users are programmers...

Hi guys and gals... A mildly humourous blog from 2013, but I come into this category... ;oDD Languager: The Poorest Computer Users are Programmers (0 Replies)
Discussion started by: wisecracker
0 Replies
READPST(1)						  libpst Utilities - Version 0.6						READPST(1)

NAME
readpst - convert PST (MS Outlook Personal Folders) files to mbox and other formats SYNOPSIS
readpst [-D] [-M] [-S] [-V] [-b] [-c format] [-d debug-file] [-e] [-h] [-j jobs] [-k] [-o output-directory] [-q] [-r] [-t output-type-codes] [-u] [-w] pstfile DESCRIPTION
readpst is a program that can read an Outlook PST (Personal Folders) file and convert it into an mbox file, a format suitable for KMail, a recursive mbox structure, or separate emails. OPTIONS
-D Include deleted items in the output. -M Output messages in MH (rfc822) format as separate files. This will create folders as named in the PST file, and will put each email together with any attachments into its own file. These files will be numbered from 1 to n with no leading zeros. This format has no from quoting. -S Output messages into separate files. This will create folders as named in the PST file, and will put each email in its own file. These files will be numbered from 1 to n with no leading zeros. Attachments will also be saved in the same folder as the email message. The attachments for message $m are saved as $m-$name where $name is (the original name of the attachment, or 'attach$n' if the attachment had no name), where $n is another sequential index with no leading zeros. This format has no from quoting. -V Show program version and exit. -b Do not save the attachments for the RTF format of the email body. -c format Set the Contact output mode. Use -cv for vcard format or -cl for an email list. -d debug-file Specify name of debug log file. The log file is now an ascii file, instead of the binary file used in previous versions. -e Same as the M option, but each output file will include an extension from (.eml, .ics, .vcf). This format has no from quoting. -h Show summary of options and exit. -j jobs Specifies the maximum number of parallel jobs. Specify 0 to suppress running parallel jobs. Folders may be processed in parallel. Output formats that place each mail message in a separate file (-M, -S, -e) may process the contents of individual folders in parallel. -k Changes the output format to KMail. This format uses mboxrd from quoting. -o output-directory Specifies the output directory. The directory must already exist, and is entered after the PST file is opened, but before any processing of files commences. -q Changes to silent mode. No feedback is printed to the screen, except for error messages. -r Changes the output format to Recursive. This will create folders as named in the PST file, and will put all emails in a file called "mbox" inside each folder. These files are then compatible with all mbox-compatible email clients. This format uses mboxrd from quoting. -t output-type-codes Specifies the item types that are processed. The argument is a sequence of single letters from (e,a,j,c) for (email, appointment, journal, contact) types. The default is to process all item types. -u Sets Thunderbird mode, a submode of recursive mode. This causes two extra .type and .size meta files to be created. This format uses mboxrd from quoting. -w Overwrite any previous output files. Beware: When used with the -S switch, this will remove all files from the target folder before writing. This is to keep the count of emails and attachments correct. FROM QUOTING
Output formats that place each mail message in a separate file (-M, -S, -e) don't do any from quoting. Output formats that place multiple email messages in a single file (-k, -r, -u) now use mboxrd from quoting rules. If none of those switches are specified, the default output format uses mboxrd from quoting rules, since it produces multiple email messages in a single file. Earlier versions used mboxo from quoting rules for all output formats. AUTHOR
This manual page was originally written by Dave Smith <dave.s@earthcorp.com>, and updated by Joe Nahmias <joe@nahmias.net> for the Debian GNU/Linux system (but may be used by others). It was subsequently updated by Brad Hards <bradh@frogmouth.net>, and converted to xml format by Carl Byington <carl@five-ten-sg.com>. COPYRIGHT
Copyright (C) 2002 by David Smith <dave.s@earthcorp.com>. XML version Copyright (C) 2008 by 510 Software Group <carl@five-ten-sg.com>. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, please write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. VERSION
0.6.54 readpst 0.6.54 2011-05-27 READPST(1)
All times are GMT -4. The time now is 04:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy