 
  
   
  
   
  
  let pending$ = new BehaviorSubject(false);
let cachedValue$ = new BehaviorSubject(null);
let observable$ = subject$.pipe(
  withLatestFrom(pending$),
  filter(([value, pending]) => !pending),
  exhaustMap(([value]) => {
    pending$.next(true);
    return timer(1000).pipe(
      mapTo(value),
      tap(result => {
        pending$.next(false);
        cachedValue$.next(result);
      })
    );
  }),
  shareReplay(1)
); 
  
   
  
   
  
   
  
   
  
   
  
   
  
   
  
  echo %PATH%         
  
   
  
   
  
  # Удаляем пробелы в конце строки
  trimmed_rule=$(echo "$rule" | sed 's/[[:space:]]*$//')
  if [[ "$trimmed_rule" =~ "$1"$ ]]; then
    echo "Rule ends with $1"
  else
    echo "Rule does not end with $1"
  fi