redirecting output and creating condition for while loop.
I have 2 questions.
1) Is there a means of directing output to a file (">") while making it still output to the console?
I have a script that calls another lengthy script.
2) I can direct the output of the lengthy script and grep it for the words "good" or "bad" to know if I need the run the script again, but how would this exactly work? I'm just looking for the most efficient code.
Rather than putting anything in a file, I'd like to just grep the output:
I'm wondering how to evaluate if ". ./lengthyScript.sh | grep bad" is true of not. If you have any suggestions here, I'd really appreciate it.
Hi,
I want to move the output of a command/script to a file as well as to to be displayed on stdout.
Can anybody help me in this. Thanks in advace ..
-Chanakya M (1 Reply)
The situation is like this:
I am reading records from a file, depending upon some condition extracting fields from the file into different variables in a loop one by one. I need to print all the variable in line, so I am trying to redirect hose variables one by one to a variable called final_value... (1 Reply)
I am trying to filter records based on number of "|", delimiter in my application. If number of "|" is greater than 14 its a bad record, else its a good record. I have to redirect output to two different files based on the if-then-else evaluation in AWK.
if number of “|” in file_0 > 14
... (2 Replies)
I'm doing this script in my Unix class and I've come to a roadblock. The purpose of this script is to search users directories for files that contain bad words i.e kill murder bomb etc., and then be able to ignore legitimate files with each use.
I got the searching and ignoring part down but now... (1 Reply)
For example,
if we run the below command,
symcfg list -thin -pool , results in an output most of the times and if the out is generated i'm able to redirect the output to a file. but sometimes it doesnt result any output and even though the output is being redirected, i can see "No Thin Pools "... (2 Replies)
hi,
OK. I am writing a bash script, and it is almost working for me.
Problem 1: I currently have stout sent to a file (stout.miRNA.bash.$date_formatted) which I would like to have work inside my loop, but when I move it, it just prints to the screen.
Problem 2: I have a second file... (18 Replies)
I wrote a code to find codons in a DNA string. The only problem I have is how do I make the code only work for a file with DNA. This means the file only has the characters a,c,g,t and no white space characters. (3 Replies)
So have I got this :
#!/bin/bash
clear
echo "Enter the first number:"
read n1
echo "Choose an operation:"
echo "1. add"
echo "2. subtract"
echo "3. multiply"
echo "4. divide"
read opr
echo "Enter the second number:"
read n2 (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Create a calculator application in your home folder called itncacl that will perform the following applications:... (5 Replies)
I have this line were I am selecting some fields from one file and creating a new file for the selected data.
awk -F "\"*,\"*" '{print $1"," $2}' folderone/list.txt > folderone/qlist.txt
This works, but then from this new file I want it to create a new file where it separates data:
$2 >5 it... (2 Replies)
Discussion started by: rluna
2 Replies
LEARN ABOUT DEBIAN
concalc
CONCALC(1) User Commands CONCALC(1)NAME
concalc - console calculator
SYNOPSIS
concalc [options] "expression"
concalc -m script "path"
DESCRIPTION
concalc calculates the given input term and returns the result as text. Please use will have problems with the shell interpretor. If you
give concalc more than one expression, all expression will be put together.
CALCULATION SYNTAX
standard calculations
2*(3+4/9)^3
standard operations
+ - * / ^ % sin cos tan asin acos atan sinh cosh tanh asinh acosh atanh ln log & | ! && || ~ >> << x rnd sqrt curt root integ d/dx
sqare root and cubic root
sqrt12 curt8
trigonometric functions and logarithms
sin3.64+ln5
other roots
fourth root of nine: 4root9
differential calculation
differential calculation of 2x^2-3x+3 at x=9: d/dx(2x^2-3x+3,9)
integration
integration of sinx+cosx between -1 and 3.2: integ(sinx+cosx,-1,3.2)
set variables
save the result of a calculation in variable A: 12*45/2->A
recall variables
multiply the saved value with 2: A*2
use last result
The last result is saved in the answer memory: ans+1
CONSTANTS
e euler constant
pi pi; example: sin(pi/2)
NUMBERS
standard
12.34
with exponent
12.23e-5
complex
12i-5
OPTIONS -o, --output [output length]
The argument is a number between 2 and the maximal possible output length (normally 18).
-m, --mode [calculator mode]
The mode can be std (default, normal scientific calculatons), base (for logic functions and base-n calculatons) or script (for exe-
cuting scripts). In scripting mode, the last argument must be the path to the script file.
-c, --complex
This option enables complex numbers for the calculation. They are switched off by default.
-b, --base [calculator base]
The argument must be one of hex (hexadecimal), dec (decimal, default), oct (octal) and bin (binary). This option can only be used
when -m base is set.
-a, --angle [angle type]
The argument must be one of deg (degrees), rad (radiant), gra (grade).
-v, --version
Output the version of Concalc.
-h, --help
Outputs a short help.
SCRIPTING
The script interpreter of calc uses a C-like programming syntax. The following command are supported.
if expression
if(condition)
command for condition true;
else command for condition false;
while loop
while(condition)
command that is run while condition is true;
for loop
for(initialisation; condition; count-command)
command that is run while condition is true;
print command
print( output to print out );
getline command
getline; // read a text line from stdin and returns this text
getkey command
getkey; // return the key pressed by the user
// blocks until the user presses any key
keystate command
keystate; // returns the key pressed by the user or 0 if no key was pressed
// nonblocking
sleep command
sleep( time in microseconds ); //Script is stops for the given time
compare operators
==, != equal, unequal
>=, <=, >, < greather or equal, less or equal, greather, less
set operators
-> calculator set operator
= C-like set operator
type converting
(float) floating point value
(int) integer value
(string) text value
(bool) boolean value
BUGS
No bugs known!
If you find one, please report it by e-mail to the author.
AUTHOR
Rainer Strobel <rainer1223@users.sourceforge.net>
SEE ALSO
http://extcalc-linux.sourceforge.net
Linux APRIL 2007 CONCALC(1)