LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-29-2015, 09:01 AM   #1
linux_nerd
LQ Newbie
 
Registered: Jun 2015
Posts: 26

Rep: Reputation: Disabled
Not able to create HERE docs in csh/tcsh


Hello all I I trying to create here docs and I get "No such file or directory" code will be below. When I change shells to bash it works as expected. The shells that I am having a issue with are csh/tcsh, any pointers as to how this works would be helpful. I am thinking it maybe a env type of problem but I am not sure what I should be looking for.
Code:
cat > testtest << EOF
 
Old 09-29-2015, 09:09 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Usually that is done in a shell script:
Code:
#!/bin/bash

cat >testtest <<EOF
data to be put in testtestfile
EOF
Also there is the ability to support indentation to make things a bit clearer:
Code:
#!/bin/bash

cat >testtest6 <<-EOF
     data to be put in testtestfile
     note, leading blanks trimmed
EOF
If the "EOF" is in quotes, then substitutions within the "data to be..." are disabled. Allowing substitutions is nice for generating reports... Things like headers/dates or special text can then be substituted on the fly.

Here documents work the same way for csh, and (I believe) tcsh.

Last edited by jpollard; 09-29-2015 at 09:12 AM.
 
Old 09-29-2015, 09:26 AM   #3
linux_nerd
LQ Newbie
 
Registered: Jun 2015
Posts: 26

Original Poster
Rep: Reputation: Disabled
Ah... I shall try that thanks.
 
Old 09-29-2015, 11:55 AM   #4
linux_nerd
LQ Newbie
 
Registered: Jun 2015
Posts: 26

Original Poster
Rep: Reputation: Disabled
Ok so I tried it in a script and it works as expected on bash but from csh/tcsh I get no such file or directory. Any Ideas why this would happen?
 
Old 09-29-2015, 12:51 PM   #5
VolumetricSteve
Member
 
Registered: Mar 2011
Posts: 90

Rep: Reputation: 7
Do you have a .cshrc or other profile file that might be messing things up? Maybe check aliases?
 
Old 09-29-2015, 02:16 PM   #6
linux_nerd
LQ Newbie
 
Registered: Jun 2015
Posts: 26

Original Poster
Rep: Reputation: Disabled
I found the root cause of my issue and it was not being caused by env setting. Thanks to everyone for your input.
 
Old 09-29-2015, 03:02 PM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by linux_nerd View Post
I found the root cause of my issue and it was not being caused by env setting. Thanks to everyone for your input.
So what was the root cause?
 
Old 09-29-2015, 03:49 PM   #8
linux_nerd
LQ Newbie
 
Registered: Jun 2015
Posts: 26

Original Poster
Rep: Reputation: Disabled
There was a script that removed expected directories from /tmp. Fixed the script the issue went away and I can create here files now
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error handling in csh/tcsh lucmove Programming 4 06-18-2010 07:07 PM
Scripts run fine on *NIX/csh, but fail on Linux/tcsh? b1f30 Programming 3 12-09-2008 08:44 AM
shell confusion..what is diff between bash, ksh, csh, tcsh..?? servnov Linux - Newbie 7 11-18-2004 08:28 PM
looking for csh or tcsh help 1ernie Linux - Software 1 04-12-2004 05:43 PM
tcsh/csh problem kicker Linux - Newbie 0 05-01-2002 03:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration