Search Results

Search: Posts Made By: Chubler_XL
Forum: Shell Programming and Scripting 3 Hours Ago
647
Posted By Chubler_XL
Say you have four values in variable VALS like...
Say you have four values in variable VALS like this a b c d then you can build an array containing these with a simple set statement.
$ set VALS="a b c d"
$ set master_array = ( $VALS )
$ echo...
55
Posted By Chubler_XL
It will make 1 pass through the filesystem from...
It will make 1 pass through the filesystem from the current directory and print the relative pathname of any files that match a1 or *f3 it encounters.
Forum: What is on Your Mind? 1 Day Ago
87
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...
134
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.
137
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...
543
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...
Forum: Linux 5 Days Ago
282
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...
543
Posted By Chubler_XL
Oops, typo in my earlier reply - thanks...
Oops, typo in my earlier reply - thanks MadeInGermany for picking this up.
543
Posted By Chubler_XL
2>&1 is an operator which duplicates file...
2>&1 is an operator which duplicates file descriptors, in this case stderr (2) is duplicated onto stdout (1) (See the Duplicating File Descriptors in the bash manual)

In command1 2>&1 | command2...
Forum: Shell Programming and Scripting 2 Weeks Ago
647
Posted By Chubler_XL
Assigning the array with set will automatically...
Assigning the array with set will automatically size to the input eg.

$ set arr=(1 2 3 4 5)
$ set newarr=(1 2 3 4 5 6 7 8 9 10)
$ echo ${#arr}
5
$ set arr=( $newarr:q )
$ echo ${#arr}
10
413
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...
86
Posted By Chubler_XL
You could look for VM[wW]are in the output from...
You could look for VM[wW]are in the output from /usr/X11/bin/scanpci as it should output something like [VMware SVGA II] PCI Display Adapter on a VMWare client.

Try:if /usr/X11/bin/scanpci | grep...
121
Posted By Chubler_XL
You should have a look at the awk tolower()...
You should have a look at the awk tolower() function.

In your case you want to replace field #1 with a lowercase version of it's self something like this:

/NAME/ { $1=tolower($1); printf "%s"...
Forum: Shell Programming and Scripting 2 Weeks Ago
647
Posted By Chubler_XL
Not quite sure what you mean by input as an array...
Not quite sure what you mean by input as an array value. It's fairly straight forward to pre-load an array with fixed values or copy an existing array into another:

$ set ar=(10 165 22 156)
$...
Forum: Shell Programming and Scripting 2 Weeks Ago
638
Posted By Chubler_XL
I think the carriage return at the end of the...
I think the carriage return at the end of the input is scrolling up the terminal. How about prompting for a single Y or N response (no need to CR):

#!/bin/bash

# -----
# function:...
121
Posted By Chubler_XL
try the following: #!/usr/bin/env bash ...
try the following:

#!/usr/bin/env bash

pkginfo -l | egrep '(BASEDIR|NAME|VERSION)' | awk '{print}' > /tmp/cp1

/usr/bin/nawk -F: '
{for (i=1; i<=NF; i++) {gsub (/^ *| *$/,...
Forum: Shell Programming and Scripting 2 Weeks Ago
647
Posted By Chubler_XL
You could try this: set ar=() set x=10 ...
You could try this:

set ar=()
set x=10
foreach i ( `seq $x`)
set ar=($ar:q " ")
end
echo ${#ar}

However with my csh (tchs 6.22.01) using $arr:q to print array elements with quotes...
Forum: Shell Programming and Scripting 2 Weeks Ago
448
Posted By Chubler_XL
From the original post we have: find path \( \ ...
From the original post we have: find path \( \
\( [folder-condition A] \) -prune -o \
\( [folder-condition B] \) -prune -o \
\( [folder-condition C] \) -prune \
\) -o \( \
\(...
552
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...
503
Posted By Chubler_XL
Do not post classroom or homework problems in the...
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum (https://www.unix.com/homework-coursework-questions/) under special...
552
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...
487
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...
664
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...
Forum: Shell Programming and Scripting 4 Weeks Ago
694
Posted By Chubler_XL
I voted for the 6/7 letter word option for a...
I voted for the 6/7 letter word option for a couple of reasons. I feel the command(s) would be more self-documenting with longer names. Google, searches, etc for command will avoid false positives...
1,709
Posted By Chubler_XL
Check your manual for rpmbuild, specifically the...
Check your manual for rpmbuild, specifically the --target PLATFORM option. As Neo pointed out you will need some 32 bit libraries installed on your 64 bit OS to be available to do this cross...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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