help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Using <<-'EOF' with python


From: Peng Yu
Subject: [Help-bash] Using <<-'EOF' with python
Date: Sun, 8 May 2016 11:24:35 -0500

Hi,

The following code shows that python may not work with <<-EOF
correctly. Is there a way to only allow bash to eat the same number of
spaces/tabs as the line where the python is being called.

~$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

for x in a b c
do
    python <<-EOF
    for i in xrange(3):
        print i

    EOF
done

~$ ./main.sh
  File "<stdin>", line 2
    print i
        ^
IndentationError: expected an indented block
  File "<stdin>", line 2
    print i
        ^
IndentationError: expected an indented block
  File "<stdin>", line 2
    print i
        ^
IndentationError: expected an indented block

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]