fork(1) download
  1. #!/bin/bash
  2. string='/abc/foo/../bar'
  3. sed -nE 's~^(/[^/]*)(/.*)?/\.\.(/[^/]*).*~\1\3~p' <<< "$string"
  4.  
Success #stdin #stdout 0.01s 5548KB
stdin
Standard input is empty
stdout
/abc/bar