i'm trying add snippet receives n arguments , tabs through of them. first argument($1) name of variable:
var $1 = and rest of arguments fill array.
['$2','$3','$#']; now tricky part this, don't know how many args go inside array. there way tell how many placeholders i'll need can tab through , type them in sequence? can use loops when defining snippets?
<snippet> <content><![cdata[ var $1 = ['$@']; ]]></content> <!-- optional: tab trigger activate snippet --> <tabtrigger>array</tabtrigger> <!-- optional: scope tab trigger active in --> <scope>source.js</scope> <!-- optional: description show in menu --> <description>create array</description> </snippet>
in bash, following substring expansion technique applied on positional parameters arguments starting second last one:
script.sh:
#!/bin/bash echo "${@:2}" calling script.sh:
bash script.sh 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9
Comments
Post a Comment