So I am new to unix, and actually anything outside drag and drop with the mouse (been learning for about a week so far) . I have been using the foreach command in tcsh because I am working on a group of files. Basically what I need is to insert part of the filename as the first line in the file. Here is what I have:
I also tried with double quotes - print($ENV{"i"}), but both only insert a blank space in the beginning of the file.
I tried in bash as well:
Again, only a blank space at the beginning of the file...
I have read some things about how it is difficult to export variables between languages (e.g. into perl), but I found one reference using $ENV with a variable from bash into perl. Is it possible to export the foreach or for variable into perl as in the command above?
Your forum has been mighty helpful over the past 3 days (I have learned tons because of it) so a big thank you to everyone that posts here!
Cheers
---------- Post updated 02-08-10 at 01:28 AM ---------- Previous update was 02-07-10 at 07:49 PM ----------
Figured it out...
And I learned about environment variables in the process...
Last edited by Scott; 02-08-2010 at 02:42 AM..
Reason: Please use code tags
I want to extract data from a ASCII file that looks like the one provided here (see input.txt). For this purpose I used sed commands. I want to chain the sed commands into a script that I can call with custom variables, instead of having to run it multiple times (Need to run the code for 30*24 =... (1 Reply)
Hi All,
I'm trying to write a simple if statement in TCSH and I honestly can't figure out what I'm doing wrong. I've played around with all sorts of permutations of syntax.
if ($DESKTOP_SESSION == "kde") then
replace "forceFontDPI=0" "forceFontDPI=96" --... (0 Replies)
Hello experts,
I have two files which I'm uploading. One is an awk script and other file acts as an input to the script via positional parameter.
awk -f intlmenu.awk jobsq.txt
This run fine in C shell on SCO OpenServer Release 5.0.7.
When I run it on Solaris 10 ( tcsh shell )
I get... (2 Replies)
#!/bin/bash
foreach valuex ( word1 word2 word3 word4 )
echo $valuex
done
the output should be:
word1
word2
word3
word4
HOW DO I MAKE THIS WORK? (1 Reply)
Sorry if this has been answered. I did search both Google and this site and did find this post: unix.com/unix-dummies-questions-answers/152992-how-ignore-errors-script.html
However, it wasn't answered.
I have the same question - how do you prevent a tcsh script from terminating when the... (4 Replies)
Greetings!
I love the power and control offered by BASH but detest its syntax! Is there some alternative *nix shell language? (other than TCSH)
Or maybe a wrapper that affords the use of BASH commands via an easier syntax?
I considered creating a complicated system of aliases to... (8 Replies)
HI,
I am having strange issues with my tcsh shell.
First, the "ln" command doesnt seem to work properly.
I have a file "target" that is pointing to "file1". I cannot access file1 but that shouldnt matter.
when I do this, ln -sf file2 target
I get permission denied that I cannot access the... (1 Reply)
I want to search line-by-line for a string in a file, and I want to do this to a series of files in a directory. I'm doing this in tcsh
This works fine to do the search:
while read i; do grep $i file2; done <file1.txt
This also works fine to read a directory:
foreach file ('/bin/ls... (1 Reply)
I wrote a simplistic script which works fine in my HP Korn environment using for in do done but when I converted it for csh it is balking at my syntax specifically the parens for the argument. Any help would be appreciated
set -x
cut -f1 -d,... (3 Replies)