Questions tagged [expr]

Command-line expression evaluator

The expr utility evaluates expressions and writes the result on standard output.

See the FreeBSD Man page.

102 questions
2
votes
1 answer

Haskell Evaluating Arithmetic Expressions and Assigning Variables

I have a datatype called expr as follows: data Expr = C Float | Expr :+ Expr | Expr :- Expr | Expr :* Expr| Expr :/ Expr What I want to do is extend the Expr datatype to allow variables and 'let' expressions
M. Freberg
  • 39
  • 1
  • 7
2
votes
1 answer

how can i get Exprs of julia code accoring to function and argtypes?

i am new in Julia. i read a doc about julia static-analysis. it gives a function. function foo(x,y) z = x + y return 2 * z end and use the julia introspection function code_typed get output: code_typed(foo,(Int64,Int64)) 1-element…
moreHope
  • 85
  • 5
2
votes
1 answer

How to fix 'Unrecognized expression $round' while applying it to stored data in pipeline using mongodb $and condition with $lookup

I have applied precision to the data coming from DB, while viewing it in browser using Angular 7. Front End: Angular 7 Back End: Java and Mongodb before precision (in db): 100.9999 after precision visible to user(2 after decimal): 101.00 There…
swap_7
  • 23
  • 1
  • 6
2
votes
0 answers

Apache 2.4: Require expr: match %{var} with strings loaded from a file

I have apache 2.4 with SSL validating client certificates. I'm trying to filter some users by the CN provided in the client cert. For that, I wrote a file with a list of permitted CN, with one CN per line. The expression need to be like: true if…
Gabriel
  • 21
  • 3
2
votes
3 answers

round to 2 decimals sh

I would like to get two decimals after the dot in this expression: 7/2 #temperature equal 7 tempeture= `cat temperature` rate= expr $temperature/2 echo "$rate" I'm getting 3 and I want 3.50. thks
Psowe
  • 23
  • 4
2
votes
1 answer

how subtract 10 minutes from a timestamp, not the current time

If I have a variable like 2005, that represents an hour and minute, in this case 08:05pm. How do I subtract 15 minutes from that. If you use expr, you do get something like 1990, which isn't a time. expr works if you are subtracting less than the…
2
votes
3 answers

Is it possible to set a cron job or bash script to run X minutes from now?

I understand I can set a cron job to run every 5 minutes with crontab -e by adding a line such as: */5 * * * * /path/to/script.sh. Is it possible to get the system time in minutes using date +"%M" for example, and then set a cron job to run at date…
bc1984adam
  • 173
  • 1
  • 9
2
votes
1 answer

Read, Store and Access Temporary Files (BASH)

I want to loaded a temporary files with the bunch of numbers from input file. The format of the script is "testing -row/-col [input file]". The input file mostly just a bunch of random numbers like 1 2 3 4 3 3 5 6 9 4 4 2 My code below is trying to…
John
  • 129
  • 9
2
votes
4 answers

bash- find average of numbers in line

I am trying to read a file line by line and find the average of the numbers in each line. I am getting the error: expr: non-numeric argument I have narrowed the problem down to sum=expr $sum + $i, but I'm not sure why the code doesn't work. while…
NateDawg87
  • 43
  • 1
  • 1
  • 8
2
votes
1 answer

I am getting expr syntax errors in bash shell for a simple program

#!/bin/bash clear echo "Enter a number" read a s = 0 while [ $a -gt 0 ] do r = ` expr $a % 10 ` s = ` expr $s + $r ` a = ` expr $a / 10 ` done echo "sum of digits is = $s" This is my code guys . I am getting a bunch of expr syntax errors. I am…
Robo Smith
  • 21
  • 1
  • 1
  • 2
2
votes
1 answer

Extracting substring in linux using expr and regex

So I have just begun learning regular expressions. I have to extract a substring within a large string. My string is basically one huge line containing a lot of stuff. I have identified the pattern based on which I need to extract. I need the number…
tofu
  • 125
  • 1
  • 3
  • 11
2
votes
3 answers

Bad formatted expr returning empty string in Tcl

This may sound silly. Bear with me. While playing around with expr, I came across the following scenario proc badExpr { a b } { return expr $a+$b } proc goodExpr { a b } { return [ expr {$a+$b} ] } puts "Bad Expression Result : --->[…
Dinesh
  • 16,014
  • 23
  • 80
  • 122
1
vote
0 answers

Error w/ R curve() function: 'expr' did not evaluate to an object of length 'n'

I am trying to write a program in R that is basically a graphing calculator. It should take a text input and then plot it. output$plot1 <- renderPlot({ tempTxt2 <- parse(text=input$userTxtVar) f1 <- function(x){ return(tempTxt2) } …
manzler.h
  • 9
  • 1
1
vote
1 answer

How can I use !expr for inline coding in qarto with python?

In my YAML Header I try this for date: date: "`!expr format(Sys.time(), '%B %d, %Y')`" date-format: dddd, D MMM YYYY lang: de But if I render I receive an error message: Invalid Date Did I use !expr in the correct way?
SebastianS
  • 477
  • 7
  • 14
1
vote
0 answers

Vim's Fold Expression Does Not Using my Function

I am trying to use expr fold in vim: I create a file in ~/.vim/ftplugin/python/folding.vim and its' content: setlocal foldmethod=expr setlocal foldexpr=GetFold(v:lnum) function! GetFold(lnum) if a:lnum > 10 return 1 endif return…
Daniel
  • 51
  • 1