Re: Passing variables to and from custom programs

2010-02-07 Thread Mike Stroyan
looks in shell script. It is used like this- myIpExec <<< "{IPaddr1} ${IPaddr2} ${IPaddr3} ${IPaddr4}" Result=$? -- Mike Stroyan

Re: string format

2009-09-23 Thread Mike Stroyan
tabs, and newlines. Be sure to put IFS back to the default for the benefit of later parts of your shell script that expect the default. You can do that with another assignment or with a subshell like this- ( IFS=" "; printf "\t%s\n" $MyVar ) -- Mike Stroyan

Re: filename pattern case-insensitive, but why?

2009-09-22 Thread Mike Stroyan
sort -k 1.1,1.1 for c in {32..126}; do eval printf '"%c - %d\n"' $(printf "$'%o'" $c) $c;done | LANG=C sort -k 1.1,1.1 The collation order lists 'a' before 'A', but actually lets a later character break a tie between otherwise equal uppercase and lowercase characters. Sort will arrange 'a1', 'A1', 'a2', and 'A2' with the '1' vs. '2' characters acting as a tiebreaker. -- Mike Stroyan

Re: Inconsistent output in terminal emulator

2009-08-24 Thread Mike Stroyan
1:busybox manual and check the details of your device. -- Mike Stroyan

Re: Need info on input keys

2009-08-02 Thread Mike Stroyan
u please > tell me how to make a start? Have a look at the readline library, which bash uses. http://tiswww.case.edu/php/chet/readline/rltop.html -- Mike Stroyan

Re: Missing .bash_history Entries

2008-05-24 Thread Mike Stroyan
will not appear when cycling through commands using the arrow keys. That is a documented feature. It only ignores lines starting with space if HISTCONTROL is set to a value including "ignorespace" or "ignoreboth". -- Mike Stroyan <[EMAIL PROTECTED]>

Re: finding the index at which two strings differ

2008-05-06 Thread Mike Stroyan
7; -f5 | tr -d , > > > > Any other suggestions? You could use substring expansion to compare characters one by one. #!/bin/bash a=$1 b=$2 if [[ "$a" == "$b" ]] then echo "'$a' and '$b' are the same" else i=0 while [[ "${a:$i:

Re: converting an array into a single variable

2008-02-20 Thread Mike Stroyan
.JPG,123456_47.JPG' a=(www/images/*);a=$(IFS=,; echo "${a[*]}";);a="${a//www\/images\/}";echo $a -- Mike Stroyan <[EMAIL PROTECTED]>

Re: Launching Apps to different desktops

2008-02-07 Thread Mike Stroyan
a wrapper application like kstart or devilspie to set the property on the window after it starts to map. That is likely to cause a visible flash as the application starts in the current workspace before it is moved to the requested workspace. I expect you would need to add one of those rather than fi

Re: Please advise on bash programming tactics/strategy

2007-12-13 Thread Mike Stroyan
d do if [[ $int == $interface ]] then echo $rxcnt $txcnt fi done } It would be more modular to use an argument to get_data to pass the interface instead of using the $interface global variable. get_data() { local int d

Re: Problem with pattern replacing when STRING is an expandable char

2007-12-12 Thread Mike Stroyan
on prevents pathname expansion. $ echo $BASH_VERSION 3.2.25(1)-release $ touch a b c.d e.f $ ls a b c.d e.f $ a=111.1 $ echo ${a//[0-9]/*} c.d e.f $ echo "${a//[0-9]/*}" ***.* $ a=111 $ echo ${a//[0-9]/*} a b c.d e.f $ echo "${a//[0-9]/*}" *** $ -- Mike Stroyan <[EMAIL PROTECTED]>

Re: how could I execute a set of script in a directoy tree?

2007-11-13 Thread Mike Stroyan
hen run r /testcase to acutally use the recursive function on /testcase. But the find command is very good at doing this as well. find /testcase -name autotest.sh -perm /111 -execdir bash -c ./autotest.sh \; -- Mike Stroyan <[EMAIL PROTECTED]>

Re: find help about 'read' built-in command

2007-11-13 Thread Mike Stroyan
uestion about directory tree walking. -- Mike Stroyan <[EMAIL PROTECTED]>

Re: find help about 'read' built-in command

2007-11-13 Thread Mike Stroyan
a bit faster than using $(pwd) to execute the pwd builtin. $ s=$SECONDS;for (( i=1;i<1;i++ )) ;do d=$(/bin/pwd);done;echo $(($SECONDS-$s)) 23 $ s=$SECONDS;for (( i=1;i<1;i++ )) ;do d=$(pwd);done;echo $(($SECONDS-$s)) 8 $ s=$SECONDS;for (( i=1;i<1;i++ )) ;do d=$PWD;done;echo

Re: SIGTTOU handling

2007-11-13 Thread Mike Stroyan
o away. You need to call setpgrp or setsid and then open a pty device to establish the pty as a control terminal. -- Mike Stroyan <[EMAIL PROTECTED]>

Re: Looping through lines with tabs of file with cat

2007-11-04 Thread Mike Stroyan
do I make it seperate items by newline only? > -- CODE -- > fileIn="blah" > for i in "$(cat $fileIn)" > do > echo $i > echo > done Don't use cat. Read the contents of the file directly with "read". fileIn="blah" while read i do echo "$i" echo done < "$fileIn" -- Mike Stroyan <[EMAIL PROTECTED]>

Re: What does the "`" Characteter Do?

2007-10-08 Thread Mike Stroyan
rectly on debian for some locales. I get good output with LANG=C man bash The problem comes from formatting of ` to an abstract 'left quote' value. That can be avoided by quoting it in the manual source as \`. That is an understandable error. Even "man groff" gets that wrong. -- Mike Stroyan <[EMAIL PROTECTED]>

Re: Readline history and bash's read -e

2007-09-02 Thread Mike Stroyan
eadline editing. #!/bin/bash history -r script_history set -o vi CMD="" while true do echo "Type something" read -e CMD history -s "$CMD" echo "You typed $CMD" case "$CMD" in stop) break ;; hi

Re: recalculate LINES and COLUMNS

2007-08-22 Thread Mike Stroyan
bash 3.2.13(1) from ubuntu 7.04. If a urxvt window is maximized or grows large enough to exceed the screen size, then the number of columns changes and $COLUMNS is updated immediately without using any kill command. (If the window is not maximized and remains small enough fit the screen then the n

Re: "CR" in PS1, doesn't reset "col" to 0

2007-01-24 Thread Mike Stroyan
in "man bash"- \[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt \] end a sequence of non-printing characters -- Mike Stroyan [EMAIL PROTECTED] _

Re: need explanation ulimit -c for limiting core dumps

2006-10-20 Thread Mike Stroyan
g. Sparse core files can cause trouble for the unwary. They may become non-sparse when copied. That takes up more disk space. -- Mike Stroyan [EMAIL PROTECTED] ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

Re: Does HIGH_FD_MAX have to be so low?

2006-10-19 Thread Mike Stroyan
On Thu, Oct 19, 2006 at 04:02:36PM -0400, Chet Ramey wrote: > Mike Stroyan wrote: > > > move_to_high_fd() only avoid open file descriptors if the > > check_new parameter is non-zero. open_shell_script() calls > > move_to_high_fd() with a check_new value of 0. The othe

Re: Does HIGH_FD_MAX have to be so low?

2006-10-19 Thread Mike Stroyan
On Thu, Oct 19, 2006 at 03:33:37PM -0400, Chet Ramey wrote: > Mike Stroyan wrote: > > > Looking at open_shell_script() in shell.c and move_to_high_fd() in > > general.c, I find that the code will force the use of fildes 255, > > (HIGH_FD_MAX), for reading the shell s

Does HIGH_FD_MAX have to be so low?

2006-10-19 Thread Mike Stroyan
file descriptor value was 1023, which would have stayed out of the way of the application's use. Does HIGH_FD_MAX need to be so low? (OK. 255 isn't _REALLY_ low.) Are there negative consequences for using a higher file descriptor when getdtablesize() reports that they are allowed?

Re: logout from interactive subshell

2006-10-12 Thread Mike Stroyan
l. It is an rlogin question. Type ~. to make rlogin to close the connection. The shells will all exit in response to that. (And you can do the same with ssh, which you should be using instead of rlogin.) -- Mike Stroyan [EMAIL PROTECTED] ___ Bug

Re: How to use [[ string =~ regexp ]]?

2006-05-21 Thread Mike Stroyan
art and end of the string. You won't get a match with [[ "string" =~ "^[a-z]$" ]] && echo match But you will get a match with [[ "string" =~ "^[a-z]{6}$" ]] && echo match because it matches the correct number of characters. -- Mike Stro

Re: unwanted expansion of variable with nested strings

2006-05-04 Thread Mike Stroyan
A little more bash syntax can quote newlines for awk. $ foo="a b c" $ lf=" " $ gawk 'BEGIN {foo="'"${foo//$lf/\\n}"'"} END {print foo}' /dev/null a b c -- Mike Stroyan [EMAIL PROTECTED] ___

Re: comment

2006-04-09 Thread Mike Stroyan
ment. COMMENT It would be safer to quote a character in the here document delimiter as I did above. That will prevent command expansion of the comment text which might have unintended side-effects. -- Mike Stroyan [EMAIL PROTECTED] ___ Bug-bash mailing

Re: Using variables in variables names

2006-03-13 Thread Mike Stroyan
rray2_3" $ set | grep pre_ _='pre_A_two[3]=array2_3' pre_A_one=([1]="array1_1" [2]="array1_1") pre_A_two=([1]="array2_1" [3]="array2_3") pre_one=simple1 pre_two=simple2 $ i=1 $ eval "echo \${pr

Re: edit-and-execute-command in non-posix vi editing mode fails with default editor

2006-03-10 Thread Mike Stroyan
On Fri, Mar 10, 2006 at 04:40:00PM -0500, Chet Ramey wrote: > Mike Stroyan wrote: ... > > Remove an extra right parenthesis from bashline.c. > > > > --- bash/bashline.c~2006-01-31 13:30:34.0 -0700 > > +++ bash/bashline.c 2006-03-09 12:32:24.0

edit-and-execute-command in non-posix vi editing mode fails with default editor

2006-03-10 Thread Mike Stroyan
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKA

Re: bash-3.0.16 fails to compile on HP-UX 11.11

2006-02-25 Thread Mike Stroyan
e for HPUX and timezone in the 3.1 version of that file. Bash 3.1 builds fine for me on HP-UX 11.11. -- Mike Stroyan [EMAIL PROTECTED] ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

Re: prompt with \[ \] corrupted by vi history search

2006-02-08 Thread Mike Stroyan
prompt problem does occur with the non-incremental-reverse-search-history (M-p) feature in emacs mode. The patch corrects that symptom as well. I don't see any problem with the incremental search. It doesn't seem to ever try to incorporate the standard prompt. -- Mike S

prompt with \[ \] corrupted by vi history search

2006-02-03 Thread Mike Stroyan
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKA

Single quotes are lost from v="$(cmd $'A\tB')"

2006-01-09 Thread mike . stroyan
+++ bash/parse.y2006-01-07 16:12:40.0 -0700 @@ -2906,8 +2906,8 @@ { if (open == ch) /* undo previous increment */ count--; - if (ch == '(')/* ) */ - nestret = parse_matched_pair (0, '(', ')'