#] #] ********************* #] "$d_bin"'strings notes.txt' # www.BillHowell.ca 25Sep2023 initial # view in text editor, using constant-width font (eg courier), tabWidth = 3 #48************************************************48 #24************************24 # Table of Contents, generate with : # $ grep "^#]" "$d_bin"'strings notes.txt' | sed "s/^#\]/ /" # #24************************24 # Setup, ToDos, #08********08 #] ??Feb2024 #08********08 #] ??Feb2024 #08********08 #] ??Feb2024 #08********08 #] ??Feb2024 #08********08 #] ??Feb2024 #08********08 #] 05Feb2024 nyet - this is NOT the problem: strings.sh - problematic "purple" coding? #] see "$d_bin"'fileops notes.txt' echo $(( \ + $(( $(( enddY - strtY )) * 525960 )) \ + $(( $(( enddM - strtM )) * 43830 )) \ + $(( $(( enddD - strtD )) * 1440 )) \ + $(( $(( enddh - strth )) * 60 )) \ + $(( $(( enddm - strtm )) )) \ )) calc(){ awk "BEGIN { print "$*" }"; } comment out calc : tPthP_get_tDeltaDays() { pinn1="$1" pinn2="$2" t1=$( pinn_timeModTo_timeUnix "$pinn1" ) t2=$( pinn_timeModTo_timeUnix "$pinn2" ) tDelta=$(( $t2 - $t1 )) # echo "Unix msecs: t1 = $t1; t2 = $t2; tDelta (ms) = $tDelta" # calc $tDelta/86400 } 14:24$ date -d "13:00:00" +%s 1707163200 >> OK, that's not the problem source "$d_bin"'fileops.sh' >> is this the problem, try fileops run.sh strings.sh comment out povr_chrP_rmBetween(povr chrP) bash "$d_bin"'strings run.sh' the problem is in fileops.sh - very serious if I can't use this!! #08********08 #] 05Feb2024 Segmentation fault: "linux" script (but not "start" script), strings.sh is problem check these : date_ddmmmyyyy_hms=$(date +"%0e%0b%0Y %0kh%0Mm%0Ss") date_ddmmmyyyy=$(date +%0e%0b%0Y) mnthYr=$(date +%0b%0Y) 13:06$ echo "$date_ddmmmyyyy" 05Feb2024 13:06$ mnthYr=$(date +%0b%0Y) 13:06$ echo "$mnthYr" Feb2024 >> these are all OK maybe # auto-update future dates sed "s||$date_ddmmmyyyy|;s||$mnthYr|" "$pinn" pinn="$d_web"'Forms/0_form notes.txt' >> works OK!! check menu in "$d_bin"'0_bin notes.txt' : any obvious typos etc? >> can't see anything obvious 13:10$ bash "$d_bin"'date update in form.sh' "$d_web"'Forms/0_form notes.txt' Segmentation fault (core dumped) >> shit! try 13:13$ cat "$d_SysMaint"'Linux/find notes.txt' | grep "^#\] " >> works!! So try menu with other items >> 1st column, items 1-8a work fine >> 2nd column, all OK >> 3rd column, OK items [27, 30, 33, 92] , Segmentation faults items [55, 66, 77, 88] That's a BIG hint! all use "$d_bin"'date update in form.sh' I changed sources?? : nyet : standard header.sh strings.sh, new 01Feb2024 : str_chrP_rmBetween() povr_chrP_rmBetween() str_chrP_rmBetween() : nChr=${#strInn} >> this is NOT used in "linux" script?? comment out - replace I tried : # echo "chrBeg = $chrBeg ,chrEnd = $chrEnd" #nChr=${#strInn} # causes "Segmentation fault" errors in script, OK command line? #nChr="${#strInn}" nChr=5 echo "nChr = $nChr" >> still doesn't fix "$d_bin"'date update in form.sh' comment out #source "$d_bin""standard header.sh" #source "$d_bin"'strings.sh' >> works!! un-uncomment source "$d_bin""standard header.sh" #source "$d_bin"'strings.sh' >> works!! #08********08 #] 25Sep2023 search "Linux and how do I revese a string?" +-----+ https://stackoverflow.com/questions/11461625/reverse-the-order-of-characters-in-a-string reverse the order of characters in a string Asked 12 years, 8 months ago Modified 12 months ago Viewed 116k times +--+ Simple: var="12345" copy=${var} len=${#copy} for((i=$len-1;i>=0;i--)); do rev="$rev${copy:$i:1}"; done echo "var: $var, rev: $rev" Output: $ bash rev var: 12345, rev: 54321 answered Jan 23, 2011 at 6:41 osdyng +--+ Presume that a variable 'var' has the value '123' var="123" Reverse the string and store in a new variable 'rav': rav=$(echo $var | rev) You'll see the 'rav' has the value of '321' using echo. echo $rav answered Feb 12, 2014 at 22:00 Nick >> Howell: 18:22$ echo 'Reverse the string and store in a new variable "rav":' | rev :"var" elbairav wen a ni erots dna gnirts eht esreveR ~ +--+ rev | tail -r (BSD) or rev | tac (GNU) also reverse lines: $ rev <<< $'12\n34' | tail -r 43 21 $ rev <<< $'12\n34' | gtac 43 21 If LC_CTYPE is C, rev reverses the bytes of multibyte characters: $ LC_CTYPE=C rev <<< あの ��め� $ export LC_ALL=C; LC_ALL=en_US.UTF-8 rev <<< あの のあ answered Apr 11, 2013 at 8:56 Lri +--+ A bash solution improving over @osdyng answer (my edit was not accepted): var="12345" rev="" for(( i=0 ; i<${#var} ; i++ )); do rev="${var:i:1}$rev"; done echo "var: $var, rev: $rev" Or an even simpler (bash) loop: var=$1 len="${#var}" i=0 rev="" while (( i