Knowledge Base
Search
New article
Authentication is disabled (development mode).
Edit article
Title
Tags
Content
<pre><code class="language-bash">### delete shortest match at "^": ### ../hmm -> ./hmm echo ${path#.} ### delete longest match at "^": ### ../hmm -> /hmm echo ${path##.} ### delete shortest match at "$": ### /hmm// -> ./hmm/ echo ${path%/} ### delete longest match at "$": ### /hmm// -> /hmm echo ${path%%/} ### replace once: ### dir/subdir/file -> dir\/subdir/file echo ${path/\//\\/} # ### replace globally: # ### dir/subdir/file -> dir\/subdir\/file #echo ${path//\//\\/} # ### replace slash at "^": # ### /absolute/path -> relative/path #echo ${path/#\///} # ### replace slash at "$": # ### /path/to/ -> /path/to #echo ${path/%\///} # ### split string at first "/": # ### /path/to/ -> path/to/ echo ${path#*/}</code></pre>
Save
Cancel