注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。
启动新会话:
tmux [new -s 会话名 -n 窗口名]
恢复会话:
| // :copyright: (c) 2017 Alex Huszagh. | |
| // :license: MIT. | |
| /** | |
| * Cartesian product algorithm. | |
| * | |
| * Lazily calculates the cartesian product from a container of containers, | |
| * of either linear (array, vector, set, unordered_set) or associative | |
| * (map, unordered_map, multimap, unordered_multimap) containers. | |
| * | |
| * The code can be used as follows: |
| #include <tuple> | |
| #include <type_traits> | |
| template <class T, class... TArgs> | |
| decltype(void(T{std::declval<TArgs>()...}), std::true_type{}) | |
| test_is_braces_constructible(int); | |
| template <class, class...> | |
| std::false_type | |
| test_is_braces_constructible(...); |
| #!/bin/bash | |
| function FileName() | |
| { | |
| if [[ $# -eq 1 ]]; then | |
| local filename=`basename $1` | |
| echo ${filename%%.*} | |
| fi | |
| } | |
| function FileExtension() | |
| { |
| #ifdef DEBUG | |
| #define macro(labmda) \ | |
| do { \ | |
| labmda; \ | |
| } while (0) | |
| #define macro_call(labmda) \ | |
| macro(labmda()) | |
| #else | |
| #define macro(labmda) | |
| #define macro_call(labmda) |
| function urlencode() { | |
| local data | |
| if [[ $# != 1 ]]; then | |
| echo "Usage: $0 string-to-urlencode" | |
| return 1 | |
| fi | |
| data="$(curl -s -o /dev/null -w %{url_effective} --get --data-urlencode "$1" "")" | |
| if [[ $? == 0 ]]; then | |
| echo "${data##/?}" | |
| fi |
| #!/bin/bash | |
| #usage multi_thread_template.sh | |
| fifo="/tmp/$$.fifo" #建立管道$$表示shell分配的进程号 | |
| mkfifo $fifo | |
| exec 6<>$fifo #将fifo的fd与6号fd绑定 | |
| thread_num=64 #启动的进程个数 | |
| count=0; | |
| #预分配资源 | |
| while [[ $count -lt $thread_num ]]; do | |
| echo >&6 |