简体   繁体   中英

add a number in fish script

I want to have a function that gets the number of lines of output from a command and adds one to it. So far I have this:

function add1
    set num (tmux list-sessions | wc -l)
    echo $num
end

Now how do I add 1 to $num ? (or while I'm assigning the variable)

请参阅用户文档中math命令:

set num (math $num + 1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM