aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-12-13 03:11:18 +1000
committerGravatar axel <axel@liljencrantz.se>2006-12-13 03:11:18 +1000
commitfd11f294bc0e1c35acae9e327026fdaa6b3546f9 (patch)
treecb317d9c0678e8d16e3a04f1ab352027d55ef870 /share
parentb3fa76c1beac9719d97917361a9d7fde2d678300 (diff)
Use the math function instead of calling bc directly in various places
darcs-hash:20061212171118-ac50b-a40709edf008f3d725e3755d5282ae5a84818c88.gz
Diffstat (limited to 'share')
-rw-r--r--share/functions/__fish_print_packages.fish2
-rw-r--r--share/functions/dirh.fish2
-rw-r--r--share/functions/umask.fish12
3 files changed, 9 insertions, 7 deletions
diff --git a/share/functions/__fish_print_packages.fish b/share/functions/__fish_print_packages.fish
index 47f65dd3..fb24ffff 100644
--- a/share/functions/__fish_print_packages.fish
+++ b/share/functions/__fish_print_packages.fish
@@ -32,7 +32,7 @@ function __fish_print_packages
set cache_file /tmp/.rpm-cache.$USER
if test -f $cache_file
cat $cache_file
- set age (echo (date +%s) - (stat -c '%Y' $cache_file) | bc)
+ set age (math (date +%s) - (stat -c '%Y' $cache_file))
set max_age 250
if test $age -lt $max_age
return
diff --git a/share/functions/dirh.fish b/share/functions/dirh.fish
index b30a44e9..40a1b0ca 100644
--- a/share/functions/dirh.fish
+++ b/share/functions/dirh.fish
@@ -12,7 +12,7 @@ function dirh -d (N_ "Print the current directory history (the back- and fwd- li
# Avoid set comment
set -l current (command pwd)
set -l separator " "
- set -l line_len (echo (count $dirprev) + (echo $dirprev $current $dirnext | wc -m) | bc)
+ set -l line_len (math (count $dirprev) + (echo $dirprev $current $dirnext | wc -m) )
if test $line_len -gt $COLUMNS
# Print one entry per line if history is long
set separator "\n"
diff --git a/share/functions/umask.fish b/share/functions/umask.fish
index 45f192fa..0c83a36a 100644
--- a/share/functions/umask.fish
+++ b/share/functions/umask.fish
@@ -2,7 +2,8 @@
function __fish_umask_parse -d "Internal umask function"
# Test if already a valid octal mask, and pad it with zeros
if echo $argv | sgrep -E '^(0|)[0-7]{1,3}$' >/dev/null
- for i in (seq (echo 5-(echo $argv|wc -c)|bc)); set argv 0$argv; end
+ set -l char_count (echo $argv| wc -c)
+ for i in (seq (math 5 - $char_count)); set argv 0$argv; end
echo $argv
else
# Test if argument really is a valid symbolic mask
@@ -22,7 +23,8 @@ function __fish_umask_parse -d "Internal umask function"
for i in 1 2 3
set tmp (echo $tmp|cut -c 2-)
- set res[$i] (echo 7-(echo $tmp|cut -c 1)|bc)
+ set -l char_count (echo $tmp|cut -c 1)
+ set res[$i] (math 7 - $char_count)
end
set -l el (echo $argv|tr , \n)
@@ -80,10 +82,10 @@ function __fish_umask_parse -d "Internal umask function"
set val 4
end
if echo $i |sgrep 'w' >/dev/null
- set val (echo $val + 2|bc)
+ set val (math $val + 2)
end
if echo $i |sgrep 'x' >/dev/null
- set val (echo $val + 1|bc)
+ set val (math $val + 1)
end
for j in $idx
@@ -101,7 +103,7 @@ function __fish_umask_parse -d "Internal umask function"
end
for i in 1 2 3
- set res[$i] (echo 7-$res[$i]|bc)
+ set res[$i] (math 7 - $res[$i])
end
echo 0$res[1]$res[2]$res[3]
end