Aggregator
安全招聘|平安银行人才招募令!
有奖调研 | 2021白帽调研启动!
Akamai Platform Update: New Security Enhancements That Intelligently Automate Application and API Security, Mitigate Online Fraud, and Reduce Burden on Security Professionals
Linux Asynchronous Copy and Paste
Asynchronous copy-paste can be helpful in a handful of situations:
- You can save the path in the clipboard and paste it later.
- You don’t have to work with super-long copy/move commands.
- Etc. (use your imagination)
You can add the following code snippet to your zshrc to add the three commands into your shell. Note that some of the syntaxes in this snippet are zsh-only. You might need to modify it a bit if you want to use it in bash or other shells.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 # async copy function ac() { unset ACOPY unset AMOVE export ACOPY=("${(@f)$(realpath -e $@)}") } # async move function am() { unset ACOPY unset AMOVE export AMOVE=("${(@f)$(realpath -e $@)}") } # async paste function ap() { if [ ! -z "$ACOPY" ]; then cp -vr "${ACOPY[@]}" . elif [ ! -z "$AMOVE" ]; then mv -v "${AMOVE[@]}" . unset AMOVE else >&2 echo 'clipboard empty' return 1 fi } Copying Files and DirectoriesYou can use the ac (stands for async-copy) command to copy one or more files/directories, and use the ap (stands for async-paste) command to paste it when you’re under another directory. Directories will be copied recursively automatically.
Asynchronously copying files and directories to a new location
You can use the am (stands for async-move) command to move one or more files/directories, and use the ap command to paste it elsewhere.
Asynchronously moving files and directories to a new location