Search Results

Search: Posts Made By: sea
1,261
Posted By sea
If you have such a file per day, this will work...
If you have such a file per day, this will work just fine:
#!/bin/bash
total=0
while read time value;do
total=$(( $total + $value))
done<input_file
echo $total
hth
3,341
Posted By sea
In your run.sh you refer to function/cleanup,...
In your run.sh you refer to function/cleanup, where it actually is functions/actions/cleanup.
Also, your function-script 'server' sources itself, which should result in an endless loop.
I'd assume,...
2,020
Posted By sea
Then you will have to live with that output, or...
Then you will have to live with that output, or redirect that too while calling the parent script.
sh -xe parent.sh 2>output.log
hth
1,730
Posted By sea
Heya Just wanted to link to the TUI thread...
Heya

Just wanted to link to the TUI thread within the "Shell Scripting & Programming" thread but could not find it.
Also searching for it didnt find the expected/searched thread.

Are you...
2,020
Posted By sea
Err... And from within said /path/script.sh,...
Err...
And from within said /path/script.sh, the this would be some sample code:
echo "this is default output" >&1
echo "this is an error message" >&2
echo_fails "This line (its error message)...
2,020
Posted By sea
You probably have a set -x inside your script...
You probably have a set -x inside your script somewhere.
That is what is causes that output, not 'some' error of the code.

Yes, as i've said, "if i may talk about using TUI", those commands are...
2,020
Posted By sea
Dude, try: while [ ! -f /tmp/checkfile.txt ] ...
Dude, try:
while [ ! -f /tmp/checkfile.txt ]
do
sleep 3
done
echo "File exists now"

Or if i may talk about using TUI:
while [ ! -f /tmp/checkfile.txt ]
do
tui-wait 3 "Checking for file...
1,020
Posted By sea
Your script will not work, as the shebang is on...
Your script will not work, as the shebang is on the same line as everything else.

So called 'One-Liners' are nice, if they are short, but yours is not.
Please structure your code for easier...
793
Posted By sea
Or with: #!/bin/bash STR="1 2 3 4 5 ...
Or with:
#!/bin/bash
STR="1
2
3
4
5
6
7
8
9
10
11"

NR=2 ## 0, 1 , 2 = 3 items in a row
C=0

for n in $STR;do
if [ $C -eq $NR ]
then printf "%s\n" "$n"
816
Posted By sea
Why using redirection for playing the video? ...
Why using redirection for playing the video?
Also, having a sleep duration of over a minute, COULD cause the 'hang' (actually just a delay) at its end, as it is waiting before writing the actualy...
Forum: What is on Your Mind? 03-01-2016
1,702
Posted By sea
I would say a Top Level Topic like Custom...
I would say a Top Level Topic like Custom Projects,
containing sub topics like:

Fun (or Small) Projects (eg: signature generator/hw parser, terminal snowfall, IP checker)
...
974
Posted By sea
Hello Galford Any attempts from your side...
Hello Galford

Any attempts from your side yet?
Where and why are you stuck?

Thank you
1,746
Posted By sea
Since your modifiying the $RANDOM with the...
Since your modifiying the $RANDOM with the length(count) of its array items, and since $RANDOM has only one, only the first items is displayed.

Hope this helps
6,094
Posted By sea
Don, why doing so much double effort? Try: ...
Don, why doing so much double effort?
Try:
#!/bin/bash
#
# Variables
#
# Expand the task list with words that describe the task
declare TASK_LIST="name email"
declare -A ANSWERS
#...
696
Posted By sea
Try: xfce4-terminal -e "nano example.txt" ...
Try:
xfce4-terminal -e "nano example.txt"

If you're on a system with multiple terminal-applications, multiple users with their own preferences, and if TUI is installed, you could also try:
...
980
Posted By sea
Your above example will fail (just like the...
Your above example will fail (just like the previous one).
Why do you put code in between cases?

After the ;;, the specific case is closed.
Before the *), no new case is opened.

Keep in mind,...
980
Posted By sea
EDIT: Obviously, instead of echo, do whatever...
EDIT:
Obviously, instead of echo, do whatever you want/need to do with that selected file1.
980
Posted By sea
You would handle that within your menu function. ...
You would handle that within your menu function.
Try:
select file1 in $(cd /user/file/data;ls);do break;done
echo $file1
hth
1,262
Posted By sea
Am I missing something with for F in $str? ...
Am I missing something with for F in $str?
Edit: Yes, I had forgotton to update that varname from a previous approach, and just edited right after posting.
Edit2: Thought, that example doesnt cover...
1,262
Posted By sea
Please use the "code" tag for code as you have...
Please use the "code" tag for code as you have agreed by the forum rules.

Have a look at:
#!/bin/sh
# My system has /bin/sh --> bin/bash, but should be posix compliant

printf "Enter a...
13,864
Posted By sea
Try this: <any valid command> echo $? [...
Try this:
<any valid command>
echo $?
[ condition ]
echo $?

There is your 'successfull' (0) or not (1), in case of bash that is.

hth
13,864
Posted By sea
Please use code tags as required by the forums...
Please use code tags as required by the forums rules you have agreed to.
Again, what have YOU tried?

But ok, according to the information you share:
That should work, why shouldnt it?

For any...
13,864
Posted By sea
There are specific threads for urgent matters. ...
There are specific threads for urgent matters.
We're not a place to do your work, so you get the salary.

As it is urgent, and according to the forum rules, let me ask this first - as you had 11...
1,551
Posted By sea
This: printf "Please enter the gene(s) of...
This:
printf "Please enter the gene(s) of interest, use a comma between multiple: "
IFS="," read -a gene
printf "the indicated genes will now be loaded and used to calculate coverage\n"
...
536
Posted By sea
Why hardcode when you can read what is there? ...
Why hardcode when you can read what is there?

Try:
BASE=/zz/xx

for section in $BASE/*
do
for item in $BASE/$section/*
do
echo "Found $item as content of $section within $BASE"
echo...
Showing results 1 to 25 of 500

 

Featured Tech Videos

All times are GMT -4. The time now is 07:26 PM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy