[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Any zsh users here? I am migrating from bash. I had a bash

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 10
Thread images: 1

File: 1462408861719.jpg (438KB, 900x2134px) Image search: [Google]
1462408861719.jpg
438KB, 900x2134px
Any zsh users here?

I am migrating from bash. I had a bash function that takes argument $1 as a parameter, but in zsh I get "no matches found". The function works, but I think i'm just not passing the argument as the parameter in the right way.

How do I do it?

# my function
function function() { osascript /usr/local/bin/function.scpt "$1" ;}
>>
>>61683162
Don't know if this'll help or if I'm just a moron who doesn't know what he's talking about, but $N, where N is any integer, are positional parameters and you can't assign anything to them.
>>
>>61683239
Code test
>>
>>61683239
No you're right, it is an arglist, just like argv[] in C-ish languages. I think you're supposed to be able to access the arglist in this way.

the way it works is i call my function, and pass it parameter $1, then execute the function.

I tried changing it to $0, $1, and $2, just in case it were indexed differently, but I'm pretty sure that my first argument is $1.
>>
by the way, the thing i am passing is an http url. in bash it just werked without any escaping, so i think zsh should be the same
>>
>>61683295
Are you passing invalid chars or globs?

>>61683347
Yeah, Zsh is finicky and you're gonna have to escape those chars.
>>
i found an answer here, but it's basically saying "turn of the zsh security features to make it like bash"

https://unix.stackexchange.com/questions/145214/must-pass-urls-in-quotes

how do i do it in the zsh way?
>>
>>61683381
Set nomatch off.

setopt +o nomatch
>>
>>61683398
how can i do that within the function, then set it back after the function runs? i already tried adding statements to my function
>>
>>61683489
It doesn't change the behaviour in any bad way, it just changes it to behave like bash.

You can try
setopt -o nomatch

to set it back to default, but it's better to just surround your inputs with quotes.
Thread posts: 10
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.