Search Results

Search: Posts Made By: Chubler_XL
2,190
Posted By Chubler_XL
In general you would use VAR=$( command ) to...
In general you would use VAR=$( command ) to capture the output of each command and then echo your result at the end like this:

#!/bin/bash

if [ $# -eq 1 ]
then
filename="/home/marco/$1"...
5,879
Posted By Chubler_XL
EXPORT allows shell variables to be passed onto...
EXPORT allows shell variables to be passed onto sub processes of the current shell not back up to the calling process.

If you want a child script to set environment variables in the parent...
54,104
Posted By Chubler_XL
I do remember you being quite concerned with...
I do remember you being quite concerned with performance in this SWARM stuff and I would have thought the bash =~ operator could be use in place of grep.

$ export NUM='[['
$ time bash -c 'echo...
35,148
Posted By Chubler_XL
Perhaps I'm misinterpreting your request but...
Perhaps I'm misinterpreting your request but would this suffice?

. ./file.txt
echo "a[1] = ${a[1]} a[2] = ${a[2]} a[3] = ${a[3]}"
echo "b[1] = ${b[1]} b[2] = ${b[2]} b[3] = ${b[3]}"
echo...
38,741
Posted By Chubler_XL
Apologies, I forgot to set $num in my example: ...
Apologies, I forgot to set $num in my example:

$ text='QIl reçoit 5 000 $ à la livraison. 5 000 $?'
$ num=1
$ echo '((1)) ((2))' > temp.tmp
$ perl -i -CA -pne 'my $val='\'"${text}"\'';...
32,799
Posted By Chubler_XL
<( list ) (process substitution) not available...
<( list ) (process substitution) not available is sh, your first example was probably using bash to run the script.

You could try this instead:

col_list='{print $64,$64,$52,$64,$64,$33}'
tail...
3,478
Posted By Chubler_XL
You could write a script that asks and then...
You could write a script that asks and then executes /bin/crontab. Put this in the PATH before /bin (eg /usr/local/bin):

Script could be something like this as an example. You may not want to...
38,741
Posted By Chubler_XL
I found the problem with the perl code $ is...
I found the problem with the perl code $ is expanded in perl RE to avoid this I put the string in a perl variable with single quotes around it like this:

$ text='QIl reçoit 5 000 $ à la livraison....
7,799
Posted By Chubler_XL
Have you considered inotifywait(1)...
Have you considered inotifywait(1) (https://www.unix.com/man-page/debian/1/inotifywait/) provided by the inotify-tools package on some distributions, this can run your script whenever a file appears...
4,187
Posted By Chubler_XL
This is working as expected in bash 4.4.12 $...
This is working as expected in bash 4.4.12

$ var="/etc/tomcat/server.xml /etc/tomcat/test/server.xml"
$ var2=( $var )
$ echo ${var2[0]}
/etc/tomcat/server.xml
$ echo ${var2[1]}...
34,612
Posted By Chubler_XL
Nice procedure nezabudka, but original request...
Nice procedure nezabudka, but original request was selection of item by number or by name:



For a higher level of difficulty how about spaces in the options:

#!/bin/bash
listofitems="fried...
6,063
Posted By Chubler_XL
Sorry about my delay in gettng back think...
Sorry about my delay in gettng back think timezone differences are involved here. looks like we have some nice solutions coming together in this thread now.

This is the pseudo code I had in mind...
Forum: What is on Your Mind? 02-20-2020
5,732
Posted By Chubler_XL
Very cool. I did a lot of mucking around...
Very cool.

I did a lot of mucking around with Simulated Annealing and the Metropolis algorithm while in uni. Using it for tasks like fitting various sized files onto minimum numbers of floppy...
1,211
Posted By Chubler_XL
A process calls the wait() function and kernel...
A process calls the wait() function and kernel level code checks the status of a child process, it will suspend execution of the calling thread until status information for one of the terminated...
Forum: Linux 02-16-2020
7,277
Posted By Chubler_XL
What value do you have for swappiness...
What value do you have for swappiness (https://en.wikipedia.org/wiki/Paging#Swappiness):

# cat /proc/sys/vm/swappiness
60


You can try tweaking this back a lower percentage (eg add/change...
807
Posted By Chubler_XL
This looks like a homework question to me, I...
This looks like a homework question to me, I hope you were told not to try running this program on a production system.
11,105
Posted By Chubler_XL
You could use sed (or similar) to convert your...
You could use sed (or similar) to convert your input syntax to an awk expression eg:

CONDITIONS="(1=CT or 2=US_10) and 3=CT_US_10 and 4="
CONDITIONS=$(echo "$CONDITIONS" |
sed \
-e...
5,347
Posted By Chubler_XL
This forum is not a script writing service. ...
This forum is not a script writing service.

If you have a solution you have worked on that is not complete we can help you, but you must have shown some effort to solve this yourself.

Also...
3,576
Posted By Chubler_XL
the first < is a standard input redirection and...
the first < is a standard input redirection and causes input to the read command to come from a file.

The second part is process substitution witch takes the format of <(list). The value list...
3,576
Posted By Chubler_XL
This is because commands within a pipeline are...
This is because commands within a pipeline are run in subshells so the read statement is setting the variables is a subshell which has not impact on the main shell.

You can achieve what you want...
4,909
Posted By Chubler_XL
That looks like a good approach. You could...
That looks like a good approach.

You could get some more efficiency by not calling the date external on each input line and using bash to convert the date time to an mmddHHMMSS number for direct...
1,182
Posted By Chubler_XL
This function is quite well commented, it...
This function is quite well commented, it basically uses the tail command to print the last MAX_LENGTH ($2) lines of FILE ($1) these are stored in a temporary file (name generated by the mktmp...
10,565
Posted By Chubler_XL
Ensure dollar variable to be expanded is outside...
Ensure dollar variable to be expanded is outside of single quotes eg:
echo 'File not found in '"$PWD"', please re-enter'

In your script you would do:

for i in `cat file1`
do
...
10,114
Posted By Chubler_XL
Firstly the posted script seems to be missing...
Firstly the posted script seems to be missing single quote at the start of the awk code, and two single quotes at the end.

Also your system is reporting that nawk is not installed nawk is usually...
Forum: Solaris 12-19-2019
15,919
Posted By Chubler_XL
Discussion moved to Solaris area, you will find...
Discussion moved to Solaris area, you will find more people with the Solaris specific knowledge to answer this question here.
Showing results 1 to 25 of 500

 
All times are GMT -4. The time now is 03:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy