I have no idea why I can't get this to work, if anybody can help i would appreciate it.
#!/bin/bash
x=`cat counter.txt | wc -l`
y= '$x / 7'
printf "%d People have visited this page" $y
:confused: (2 Replies)
I am using egrep to extract numbers from a file and storing them as variables in a script. But I am not able to do any arithmetic operations on the variables using "expr" because it stores them as char and not integers. Here is my code and the error I get. Any help will be appreciated.
#!/bin/sh... (3 Replies)
Hi all,
I would appreciate if anyone knows how to perform adding to date.
As for normal date, i can easily plus with any number.
But when it comes to month end say for example 28 Jun, i need to perform a plus with number 3, it will not return 1 Jul.
Thanks in advance for your help. (4 Replies)
Hi
I have a file with 3 columns. say,
infile:
1 50 68
34 3 23
23 4 56
-------
-------
I want to generate n files from this file using a loop so that 1st column in output file is (column1 of infile/(2*n+2.561))
I am doing like this:
for ((i=1; i<=3; i++))
do
a=`echo... (3 Replies)
I am writing a script in zsh shell, it fetchs a number from a file using the awk command, store it as a variable, which in my case is a small number 0.62000. I want to change this number by multiplying it by 1000 to become 620.0 using the command in the script
var2=$((var1*1000))
trouble is... (2 Replies)
input:
Name|Operation
rec_10|1+2+2-
Output:
rec_10|1
Basically I am trying to calculate the result of "the path" in $3 where the operators follow the number and not preceding them like we normally do:
rec_10: +1+2-2=1
But I realise (I am sure there is a good reason for that) that awk... (7 Replies)
Hi,
Here is the script i try to perform arithmetic operation in two variables .
git branch -r | while read brname ; do
REV_COMMITS=`git rev-list --count $brname`
echo "$brname has $REV_COMMITS"
(( TOTAL = TOTAL + REV_COMMITS ))
echo "in loop" $TOTAL
done
echo "total is " $TOTAL
... (3 Replies)
I have to do some arithmetic operation on Field 8 which is calculated by Field 9/Field 7
Suppose i have data like :
0800123456|JAN|2017|JAN|2018|0800123456|0|0.0000|0.00|
0800234567|JAN|2017|JAN|2018|0800234567|4|2.5812|10.32|
0800666666|JAN|2017|JAN|2018|0800666666|2|1.7255|3.45|... (0 Replies)
Discussion started by: pumrao
0 Replies
LEARN ABOUT DEBIAN
shtool-path
SHTOOL-PATH.TMP(1) GNU Portable Shell Tool SHTOOL-PATH.TMP(1)NAME
shtool-path - GNU shtool command dealing with shell path variables
SYNOPSIS
shtool path [-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename] [-m|--magic] [-p|--path path] str [str ...]
DESCRIPTION
This command deals with shell $PATH variables. It can find a program through one or more filenames given by one or more str arguments. It
prints the absolute filesystem path to the program displayed on "stdout" plus an exit code of 0 if it was really found.
OPTIONS
The following command line options are available.
-s, --suppress
Supress output. Useful to only test whether a program exists with the help of the return code.
-r, --reverse
Transform a forward path to a subdirectory into a reverse path.
-d, --dirname
Output the directory name of str.
-b, --basename
Output the base name of str.
-m, --magic
Enable advanced magic search for ""perl"" and ""cpp"".
-p, --path path
Search in path. Default is to search in $PATH.
EXAMPLE
# shell script
awk=`shtool path -p "${PATH}:." gawk nawk awk`
perl=`shtool path -m perl`
cpp=`shtool path -m cpp`
revpath=`shtool path -r path/to/subdir`
HISTORY
The GNU shtool path command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 1998 for Apache. It was later taken
over into GNU shtool.
SEE ALSO shtool(1), which(1).
18-Jul-2008 shtool 2.0.8 SHTOOL-PATH.TMP(1)