Search Results

Search: Posts Made By: Chubler_XL
5,561
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"...
11,505
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...
112,148
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...
63,314
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...
78,472
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}"\'';...
69,156
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...
5,696
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...
78,472
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....
16,930
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...
8,567
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]}...
62,581
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...
13,268
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
9,957
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...
2,291
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
14,340
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...
1,665
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.
21,534
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...
10,000
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...
7,463
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...
7,463
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...
6,860
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...
2,113
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...
15,185
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
...
14,636
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
24,913
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 07:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy