Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
d9aece92
Commit
d9aece92
authored
Aug 19, 2014
by
Roman Inflianskas
Committed by
Bruno Pinto
Oct 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bak plugin: add unbak function (inverse to mvbak)
parent
9f3a151a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
plugins/bak/unbak.fish
plugins/bak/unbak.fish
+22
-0
No files found.
plugins/bak/unbak.fish
0 → 100644
View file @
d9aece92
# Function to move files and directories (a.txt.20140608_195859.bak move to a.txt)
# (c) Roman Inflianskas (rominf) <infroma@gmail.com>, 2014
function unbak
set re_bak '(.*)\.[0-9]{8,8}_[0-9]{6,6}\.bak'
set file $argv[1]
set normalized (echo "$file" | sed -E "s/$re_bak/\1/g")
function is_bak
echo "$file" | perl -ne "print if /$re_bak/" > /dev/null
end
if test ! -e $file
echo "File \"$file\" not exists! Cannot unbak \"$file\"."
else if not is_bak $file
echo "File \"$file\" don't meet bak files convention! Cannot unbak \"$file\"."
else if test -e $normalized
echo "File \"$normalized\" exists! Cannot unbak \"$file\"."
else
mv $file $normalized
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment