"tcsh: how to prevent a foreach from terminating a script when the result is null?"

Post #302594124 by deepstructure on Monday 30th of January 2012 01:43:07 PM

Originally Posted by itkamaraj

if you set the "nonomatch" variable:
set nonomatch

then the C shell behaves like the Bourne Shell.
Ah, that seems to do the trick. Thanks!
Test Your Knowledge in Computers #706
Difficulty: Medium
Shared information bias is known as the tendency for group members to spend more time and energy discussing information that all members are already familiar with (i.e., shared information), and less time and energy discussing information that only some members are aware of.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

terminating script with CTRL+D

Hi, I'm trying to make a script that reads the console input and terminates with CTRL+D. It's absolutely basic but I don't know how to "read" the CTRL+D. I've tried a bunch of things like EOT=^D while //with & without quotations do read input echo $input done while while ] ... (12 Replies)
Discussion started by: sanchopansa
12 Replies

2. UNIX for Dummies Questions & Answers

Terminating child script with terminating the parent script

Hi I was working on a shell script with randomly shows a page of text from a randomly selected topic .As soon as the page is displayed it callers a timer script which keeps on running indefinitely until the timer script is killed by the user. This is where I have the problem,if I press... (2 Replies)
Discussion started by: mervin2006
2 Replies

3. Shell Programming and Scripting

script unexpectedly terminating

I now that this isnt the greatest code around. Im a network guy by trade not a programer .. but needed something to compare config files ... Anyway ... intermittently, the program terminates. Ive been looking at the code for a week trying to figure it out and Im stumped. Can anyone provide... (0 Replies)
Discussion started by: popeye
0 Replies

4. Shell Programming and Scripting

simple tcsh question using foreach

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)
Discussion started by: moldoverb
1 Replies

5. Shell Programming and Scripting

How can i terminating expect script without terminating SSH connection.

Hi all , i know i ask a lot of question but these are really hard to solve and important question. I send two scripts: expect.sh: #!/usr/local/bin/expect spawn ssh root@ expect "login:" send "root\n" expect "password:" send "root\n^M" interact and son.sh: ... (2 Replies)
Discussion started by: fozay
2 Replies

6. Shell Programming and Scripting

prevent ssh from executing result in shell

Hi, I am writing a script on Solaris 10 and want to execute a remote ssh command. Normally this command should just return the value 0000000000002356 but when using ssh it seems it is passing the result to the shell to execute. ssh root@ `/usr/bin/nawk -F\, '$1=="USG" && $2=="01"... (3 Replies)
Discussion started by: borderblaster
3 Replies

7. Shell Programming and Scripting

for / foreach syntax issues (in bash or tcsh)

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.... (0 Replies)
Discussion started by: thepolypore
0 Replies

8. UNIX for Advanced & Expert Users

why the script is not terminating with proper results

Hi everyone, I am new to the linux.I wrote a small script and assigning two values to fname and lname and I want if the fname or lname are not given proper name like Toys or Gun the script should terminate and if they are given proper name it should execute.please help thanks:wall: #!/bin/bash... (4 Replies)
Discussion started by: starter2011
4 Replies

9. Shell Programming and Scripting

How to get following result using foreach command?

Dear all, For example, if data contains following numbers:1 2 3 4 5 6 I would like get like below using foreach command,1 2 1 3 1 4 1 5 1 6 2 3 2 4 2 5 2 6 3 4 3 5 3 6 4 5 (1 Reply)
Discussion started by: Ryan Kim
1 Replies
source(n)						       Tcl Built-In Commands							 source(n)


source - Evaluate a file or resource as a Tcl script SYNOPSIS
source fileName source -encoding encodingName fileName | _________________________________________________________________ DESCRIPTION
This command takes the contents of the specified file or resource and passes it to the Tcl interpreter as a text script. The return value from source is the return value of the last command executed in the script. If an error occurs in evaluating the contents of the script then the source command will return that error. If a return command is invoked from within the script then the remainder of the file will be skipped and the source command will return normally with the result from the return command. The end-of-file character for files is "32" (^Z) for all platforms. The source command will read files up to this character. This restriction does not exist for the read or gets commands, allowing for files containing code and data segments (scripted documents). If you require a "^Z" in code for string comparison, you can use "32" or "u001a", which will be safely substituted by the Tcl interpreter into "^Z". The -encoding option is used to specify the encoding of the data stored in fileName. When the -encoding option is omitted, the system | encoding is assumed. EXAMPLE
Run the script in the file foo.tcl and then the script in the file bar.tcl: source foo.tcl source bar.tcl Alternatively: foreach scriptFile {foo.tcl bar.tcl} { source $scriptFile } SEE ALSO
file(n), cd(n), encoding(n), info(n) KEYWORDS
file, script Tcl source(n)

Featured Tech Videos

All times are GMT -4. The time now is 09:44 PM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy