Using for in one-liner

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Wed Aug 17 15:34:58 EDT 2005


BranoZ wrote:
> Paul Watson wrote:
>> Using a '$' before the string works in the ksh that is part of FC4.
>> However, it does not work on the pdksh that is in FC3 and Cygwin.  It
>> also does not work on AIX ksh.
>>
>> $ print $'now'
>> $now
> 
> In bash you can also use Ctrl-v followed by special character.
> (I used to reset terminal by echo "<Ctrl-v><Esc>c"<Enter>)
> 
> Ctrl-v, Enter -> generate 0x0d to command-line
> Crtl-v, Ctrl-m -> the same as above
> Ctrl-v, Ctrl-j -> generate 0x0a (UNIX \n)
> 
> So type:
> python -c 'import sys;
> then press Ctrl-v followed by Ctrl-j
> and type the rest..
> 
> In vi it looks like ^@. At CLI it realy does a newline.
> I guess, you can no longer call it an one-liner ;-)
> 
> I'm not sure whether Ctrl-v is a bash feature. More probably
> the tty driver. So, it may be worth tring it on bash-less UNIXes
> (that deserve to extinct)

You can as well use Enter directly on the command line, together with
quotes.

Reinhold



More information about the Python-list mailing list