Skip to main content
added 374 characters in body
Source Link
vesii
  • 223
  • 1
  • 8
  • 21

I need some help debugging my tcsh script. It uses heredocs. The code:

<pre_setup> <<EOF1
<setup> <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

The <pre_setup> is some pre setup command (like wash) and setup is some setup that runs after it. It works but I noticed that if setup contains single quotes, it fails. My setup looks like:

run_setup -cmd '$SOME_ENV -o outdir'

The run_setup sets $SOME_ENV and executes $SOME_ENV -o outdir. So running:

wash -n group_name <<EOF1
run_setup -cmd '$SOME_ENV -o outdir' <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

Fails with SOME_ENV: Undefined variable.. It's not problem of wash in pre_setup because If I use setenv X 1 (or cat) as pre_setup, it still fails with the same error. It has something to do with the way heredocs works. How can I make it work? Is it problem of escaping? How to debug heredocs?

Also I will mention that running run_setup -cmd '$SOME_ENV -o outdir' in the shell, works. And even running pre_setup and then this setup works. So it hes something to do with heredocs.

EDIT: Wrapping it with quotes, break code like this:

/bin/tcsh <<EOF
$WORK_AREA/script.sh.$1
echo \$status > $WORK_AREA/.$1.result
exit 0
EOF

where $1$ is the the input of the script which has this heredocs. When wrapping with single quotes, the $1 in $WORK_AREA/script.sh.$1 is empty. But without the quotes, it works. Why? How can I solve it?

I need some help debugging my tcsh script. It uses heredocs. The code:

<pre_setup> <<EOF1
<setup> <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

The <pre_setup> is some pre setup command (like wash) and setup is some setup that runs after it. It works but I noticed that if setup contains single quotes, it fails. My setup looks like:

run_setup -cmd '$SOME_ENV -o outdir'

The run_setup sets $SOME_ENV and executes $SOME_ENV -o outdir. So running:

wash -n group_name <<EOF1
run_setup -cmd '$SOME_ENV -o outdir' <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

Fails with SOME_ENV: Undefined variable.. It's not problem of wash in pre_setup because If I use setenv X 1 (or cat) as pre_setup, it still fails with the same error. It has something to do with the way heredocs works. How can I make it work? Is it problem of escaping? How to debug heredocs?

Also I will mention that running run_setup -cmd '$SOME_ENV -o outdir' in the shell, works. And even running pre_setup and then this setup works. So it hes something to do with heredocs.

I need some help debugging my tcsh script. It uses heredocs. The code:

<pre_setup> <<EOF1
<setup> <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

The <pre_setup> is some pre setup command (like wash) and setup is some setup that runs after it. It works but I noticed that if setup contains single quotes, it fails. My setup looks like:

run_setup -cmd '$SOME_ENV -o outdir'

The run_setup sets $SOME_ENV and executes $SOME_ENV -o outdir. So running:

wash -n group_name <<EOF1
run_setup -cmd '$SOME_ENV -o outdir' <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

Fails with SOME_ENV: Undefined variable.. It's not problem of wash in pre_setup because If I use setenv X 1 (or cat) as pre_setup, it still fails with the same error. It has something to do with the way heredocs works. How can I make it work? Is it problem of escaping? How to debug heredocs?

Also I will mention that running run_setup -cmd '$SOME_ENV -o outdir' in the shell, works. And even running pre_setup and then this setup works. So it hes something to do with heredocs.

EDIT: Wrapping it with quotes, break code like this:

/bin/tcsh <<EOF
$WORK_AREA/script.sh.$1
echo \$status > $WORK_AREA/.$1.result
exit 0
EOF

where $1$ is the the input of the script which has this heredocs. When wrapping with single quotes, the $1 in $WORK_AREA/script.sh.$1 is empty. But without the quotes, it works. Why? How can I solve it?

added 195 characters in body
Source Link
vesii
  • 223
  • 1
  • 8
  • 21

I need some help debugging my tcsh script. It uses heredocs. The code:

<pre_setup> <<EOF1
<setup> <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

The <pre_setup> is some pre setup command (like wash) and setup is some setup that runs after it. It works but I noticed that if setup contains single quotes, it fails. My setup looks like:

run_setup -cmd '$SOME_ENV -o outdir'

The run_setup sets $SOME_ENV and executes $SOME_ENV -o outdir. So running:

wash -n group_name <<EOF1
run_setup -cmd '$SOME_ENV -o outdir' <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

Fails with SOME_ENV: Undefined variable.. It's not problem of wash in pre_setup because If I use setenv X 1 (or cat) as pre_setup, it still fails with the same error. It has something to do with the way heredocs works. How can I make it work? Is it problem of escaping? How to debug heredocs?

Also I will mention that running run_setup -cmd '$SOME_ENV -o outdir' in the shell, works. And even running pre_setup and then this setup works. So it hes something to do with heredocs.

I need some help debugging my tcsh script. It uses heredocs. The code:

<pre_setup> <<EOF1
<setup> <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

The <pre_setup> is some pre setup command (like wash) and setup is some setup that runs after it. It works but I noticed that if setup contains single quotes, it fails. My setup looks like:

run_setup -cmd '$SOME_ENV -o outdir'

The run_setup sets $SOME_ENV and executes $SOME_ENV -o outdir. So running:

wash -n group_name <<EOF1
run_setup -cmd '$SOME_ENV -o outdir' <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

Fails with SOME_ENV: Undefined variable.. It's not problem of wash in pre_setup because If I use setenv X 1 (or cat) as pre_setup, it still fails with the same error. It has something to do with the way heredocs works. How can I make it work? Is it problem of escaping? How to debug heredocs?

I need some help debugging my tcsh script. It uses heredocs. The code:

<pre_setup> <<EOF1
<setup> <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

The <pre_setup> is some pre setup command (like wash) and setup is some setup that runs after it. It works but I noticed that if setup contains single quotes, it fails. My setup looks like:

run_setup -cmd '$SOME_ENV -o outdir'

The run_setup sets $SOME_ENV and executes $SOME_ENV -o outdir. So running:

wash -n group_name <<EOF1
run_setup -cmd '$SOME_ENV -o outdir' <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

Fails with SOME_ENV: Undefined variable.. It's not problem of wash in pre_setup because If I use setenv X 1 (or cat) as pre_setup, it still fails with the same error. It has something to do with the way heredocs works. How can I make it work? Is it problem of escaping? How to debug heredocs?

Also I will mention that running run_setup -cmd '$SOME_ENV -o outdir' in the shell, works. And even running pre_setup and then this setup works. So it hes something to do with heredocs.

added 11 characters in body
Source Link
vesii
  • 223
  • 1
  • 8
  • 21

I need some help debugging my tcsh script. It uses heredocs. The code:

<pre_setup> <<EOF1
<setup> <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

The <pre_setup> is some pre setup command (like wash) and setup is some setup that runs after it. It works but I noticed that if setup contains single quotes, it fails. My setup looks like:

run_setup -cmd '$SOME_ENV -o outdir'

The run_setup sets $SOME_ENV and executes $SOME_ENV -o outdir. So running:

wash -n group_name <<EOF1
run_setup -cmd '$SOME_ENV -o outdir' <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

Fails with SOME_ENV: Undefined variable.. It's not problem of wash in pre_setup because If I use setenv X 1 (or cat) as pre_setup, it still fails with the same error. It has something to do with the way heredocs works. How can I make it work? Is it problem of escaping? How to debug heredocs?

I need some help debugging my tcsh script. It uses heredocs. The code:

<pre_setup> <<EOF1
<setup> <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

The <pre_setup> is some pre setup command (like wash) and setup is some setup that runs after it. It works but I noticed that if setup contains single quotes, it fails. My setup looks like:

run_setup -cmd '$SOME_ENV -o outdir'

The run_setup sets $SOME_ENV and executes $SOME_ENV -o outdir. So running:

wash -n group_name <<EOF1
run_setup -cmd '$SOME_ENV -o outdir' <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

Fails with SOME_ENV: Undefined variable.. It's not problem of wash in pre_setup because If I use setenv X 1 as pre_setup, it still fails with the same error. It has something to do with the way heredocs works. How can I make it work? Is it problem of escaping? How to debug heredocs?

I need some help debugging my tcsh script. It uses heredocs. The code:

<pre_setup> <<EOF1
<setup> <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

The <pre_setup> is some pre setup command (like wash) and setup is some setup that runs after it. It works but I noticed that if setup contains single quotes, it fails. My setup looks like:

run_setup -cmd '$SOME_ENV -o outdir'

The run_setup sets $SOME_ENV and executes $SOME_ENV -o outdir. So running:

wash -n group_name <<EOF1
run_setup -cmd '$SOME_ENV -o outdir' <<EOF2

<command>

exit 0
EOF2
exit 0
EOF1

Fails with SOME_ENV: Undefined variable.. It's not problem of wash in pre_setup because If I use setenv X 1 (or cat) as pre_setup, it still fails with the same error. It has something to do with the way heredocs works. How can I make it work? Is it problem of escaping? How to debug heredocs?

Source Link
vesii
  • 223
  • 1
  • 8
  • 21
Loading