I have 4 directories: dir1 dir2 dir3 dir4. I want to create a file in each directory. I know I can do this: touch file1.txt and then move it to dir1, then touch file2.txt then move it to dir2 but it takes ages. How can I create a function that creates a text file in each of the directories? Thanks
In my dotfiles I have some functions that rely on aliases or functions to exist for them to work. For some reason, I can get them to reference other functions I have created, but not aliases for commands. How do I fix this?
Example:
function open-dotfiles-commit(){
xopen https://github.com/fatso83/dotfiles/blob/$1;
}
If I have an alias xopen
(alias xopen=xdg-open
), the open-dotfiles-commit
command will fail with xopen: cannot find command
. On the other hand, if I replace the alias definition with a function called xopen
(function xopen(){ xdg-open; };
) it works!
I have even tried setting shopt -s expand_aliases
in the same file as where I define the aliases - unsuccessfully. The alias and functions file is sourced by my .bashrc
.
I am wondering if there a way to convert a dollar value into words within LibreOffice Calc version 6.0.3.2
$1932.19
Would Become
One Thousand Nine Hundred Thirty Two Dollars And Nineteen Cents
I've found this function. It was lasted updated in 2010. It isn't compatible. The given example
=MONEYTEXT(25)
Returns
ERR: 504
Does anyone have an alternative suggestion?
For an assignment I have to write a function that prints the number of even numbers when provided with a sequence of numbers.
I used the piece of code I used for a previous assignment (to print 1
when a number was even and 0
when the number was odd)
My problem now is that my function keeps printing 0
.
What am I doing wrong?
Here's my script:
#!/usr/bin/bash
# File: nevens.sh
# Write a function called nevens which prints the number of even numbers when provided with a sequence of numbers.
# Check: input nevens 42 6 7 9 33 = output 2
function nevens {
local sum=0
for element in $@
do
let evencheck=$(( $# % 2 ))
if [[ $evencheck -eq 0 ]]
then
let sum=$sum+1
fi
done
echo $sum
}