1 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
2 |
DENIED
|
moderate
|
App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
} |
|
Show voter details
|
3 |
DENIED
|
edit
|
App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
} |
|
Show voter details
|
4 |
DENIED
|
moderate
|
App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
} |
|
Show voter details
|
5 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
6 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4162
+user: App\Entity\User {#4110 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: "Try something like `IFS=‘|’ read f1 f2 < <(zenity <…>)` where f1, f2 etc. are variable names."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1729147158 {#4172
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4160 …}
+nested: Doctrine\ORM\PersistentCollection {#4158 …}
+votes: Doctrine\ORM\PersistentCollection {#4156 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4122 …}
+notifications: Doctrine\ORM\PersistentCollection {#4126 …}
-id: 346905
-bodyTs: "'etc':12 'f1':6,10 'f2':7,11 'if':4 'like':3 'name':15 'read':5 'someth':2 'tri':1 'variabl':14 'zeniti':8"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/7821979"
+editedAt: DateTimeImmutable @1729132765 {#4108
date: 2024-10-17 04:39:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706445108 {#4171
date: 2024-01-28 13:31:48.0 +01:00
}
} |
|
Show voter details
|
7 |
DENIED
|
edit
|
App\Entity\EntryComment {#4162
+user: App\Entity\User {#4110 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: "Try something like `IFS=‘|’ read f1 f2 < <(zenity <…>)` where f1, f2 etc. are variable names."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1729147158 {#4172
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4160 …}
+nested: Doctrine\ORM\PersistentCollection {#4158 …}
+votes: Doctrine\ORM\PersistentCollection {#4156 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4122 …}
+notifications: Doctrine\ORM\PersistentCollection {#4126 …}
-id: 346905
-bodyTs: "'etc':12 'f1':6,10 'f2':7,11 'if':4 'like':3 'name':15 'read':5 'someth':2 'tri':1 'variabl':14 'zeniti':8"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/7821979"
+editedAt: DateTimeImmutable @1729132765 {#4108
date: 2024-10-17 04:39:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706445108 {#4171
date: 2024-01-28 13:31:48.0 +01:00
}
} |
|
Show voter details
|
8 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4162
+user: App\Entity\User {#4110 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: "Try something like `IFS=‘|’ read f1 f2 < <(zenity <…>)` where f1, f2 etc. are variable names."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1729147158 {#4172
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4160 …}
+nested: Doctrine\ORM\PersistentCollection {#4158 …}
+votes: Doctrine\ORM\PersistentCollection {#4156 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4122 …}
+notifications: Doctrine\ORM\PersistentCollection {#4126 …}
-id: 346905
-bodyTs: "'etc':12 'f1':6,10 'f2':7,11 'if':4 'like':3 'name':15 'read':5 'someth':2 'tri':1 'variabl':14 'zeniti':8"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/7821979"
+editedAt: DateTimeImmutable @1729132765 {#4108
date: 2024-10-17 04:39:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706445108 {#4171
date: 2024-01-28 13:31:48.0 +01:00
}
} |
|
Show voter details
|
9 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
10 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4379
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: App\Entity\EntryComment {#4162
+user: App\Entity\User {#4110 …}
+entry: App\Entity\Entry {#2412}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: "Try something like `IFS=‘|’ read f1 f2 < <(zenity <…>)` where f1, f2 etc. are variable names."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1729147158 {#4172
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4160 …}
+nested: Doctrine\ORM\PersistentCollection {#4158 …}
+votes: Doctrine\ORM\PersistentCollection {#4156 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4122 …}
+notifications: Doctrine\ORM\PersistentCollection {#4126 …}
-id: 346905
-bodyTs: "'etc':12 'f1':6,10 'f2':7,11 'if':4 'like':3 'name':15 'read':5 'someth':2 'tri':1 'variabl':14 'zeniti':8"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/7821979"
+editedAt: DateTimeImmutable @1729132765 {#4108
date: 2024-10-17 04:39:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706445108 {#4171
date: 2024-01-28 13:31:48.0 +01:00
}
}
+root: App\Entity\EntryComment {#4162}
+body: "If you leave some of the field blank will it be able to skip assigning the respective variable? That’s one problem with the positional values."
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1706452051 {#4377
date: 2024-01-28 15:27:31.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#4380 …}
+nested: Doctrine\ORM\PersistentCollection {#4382 …}
+votes: Doctrine\ORM\PersistentCollection {#4384 …}
+reports: Doctrine\ORM\PersistentCollection {#4386 …}
+favourites: Doctrine\ORM\PersistentCollection {#4388 …}
+notifications: Doctrine\ORM\PersistentCollection {#4390 …}
-id: 347056
-bodyTs: "'abl':12 'assign':15 'blank':8 'field':7 'leav':3 'one':21 'posit':25 'problem':22 'respect':17 'skip':14 'valu':26 'variabl':18"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://discuss.tchncs.de/comment/6920864"
+editedAt: null
+createdAt: DateTimeImmutable @1706452051 {#4378
date: 2024-01-28 15:27:31.0 +01:00
}
} |
|
Show voter details
|
11 |
DENIED
|
edit
|
App\Entity\EntryComment {#4379
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: App\Entity\EntryComment {#4162
+user: App\Entity\User {#4110 …}
+entry: App\Entity\Entry {#2412}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: "Try something like `IFS=‘|’ read f1 f2 < <(zenity <…>)` where f1, f2 etc. are variable names."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1729147158 {#4172
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4160 …}
+nested: Doctrine\ORM\PersistentCollection {#4158 …}
+votes: Doctrine\ORM\PersistentCollection {#4156 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4122 …}
+notifications: Doctrine\ORM\PersistentCollection {#4126 …}
-id: 346905
-bodyTs: "'etc':12 'f1':6,10 'f2':7,11 'if':4 'like':3 'name':15 'read':5 'someth':2 'tri':1 'variabl':14 'zeniti':8"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/7821979"
+editedAt: DateTimeImmutable @1729132765 {#4108
date: 2024-10-17 04:39:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706445108 {#4171
date: 2024-01-28 13:31:48.0 +01:00
}
}
+root: App\Entity\EntryComment {#4162}
+body: "If you leave some of the field blank will it be able to skip assigning the respective variable? That’s one problem with the positional values."
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1706452051 {#4377
date: 2024-01-28 15:27:31.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#4380 …}
+nested: Doctrine\ORM\PersistentCollection {#4382 …}
+votes: Doctrine\ORM\PersistentCollection {#4384 …}
+reports: Doctrine\ORM\PersistentCollection {#4386 …}
+favourites: Doctrine\ORM\PersistentCollection {#4388 …}
+notifications: Doctrine\ORM\PersistentCollection {#4390 …}
-id: 347056
-bodyTs: "'abl':12 'assign':15 'blank':8 'field':7 'leav':3 'one':21 'posit':25 'problem':22 'respect':17 'skip':14 'valu':26 'variabl':18"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://discuss.tchncs.de/comment/6920864"
+editedAt: null
+createdAt: DateTimeImmutable @1706452051 {#4378
date: 2024-01-28 15:27:31.0 +01:00
}
} |
|
Show voter details
|
12 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4379
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: App\Entity\EntryComment {#4162
+user: App\Entity\User {#4110 …}
+entry: App\Entity\Entry {#2412}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: "Try something like `IFS=‘|’ read f1 f2 < <(zenity <…>)` where f1, f2 etc. are variable names."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1729147158 {#4172
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4160 …}
+nested: Doctrine\ORM\PersistentCollection {#4158 …}
+votes: Doctrine\ORM\PersistentCollection {#4156 …}
+reports: Doctrine\ORM\PersistentCollection {#4154 …}
+favourites: Doctrine\ORM\PersistentCollection {#4122 …}
+notifications: Doctrine\ORM\PersistentCollection {#4126 …}
-id: 346905
-bodyTs: "'etc':12 'f1':6,10 'f2':7,11 'if':4 'like':3 'name':15 'read':5 'someth':2 'tri':1 'variabl':14 'zeniti':8"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.ml/comment/7821979"
+editedAt: DateTimeImmutable @1729132765 {#4108
date: 2024-10-17 04:39:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706445108 {#4171
date: 2024-01-28 13:31:48.0 +01:00
}
}
+root: App\Entity\EntryComment {#4162}
+body: "If you leave some of the field blank will it be able to skip assigning the respective variable? That’s one problem with the positional values."
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1706452051 {#4377
date: 2024-01-28 15:27:31.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@bizdelnick@lemmy.ml"
]
+children: Doctrine\ORM\PersistentCollection {#4380 …}
+nested: Doctrine\ORM\PersistentCollection {#4382 …}
+votes: Doctrine\ORM\PersistentCollection {#4384 …}
+reports: Doctrine\ORM\PersistentCollection {#4386 …}
+favourites: Doctrine\ORM\PersistentCollection {#4388 …}
+notifications: Doctrine\ORM\PersistentCollection {#4390 …}
-id: 347056
-bodyTs: "'abl':12 'assign':15 'blank':8 'field':7 'leav':3 'one':21 'posit':25 'problem':22 'respect':17 'skip':14 'valu':26 'variabl':18"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://discuss.tchncs.de/comment/6920864"
+editedAt: null
+createdAt: DateTimeImmutable @1706452051 {#4378
date: 2024-01-28 15:27:31.0 +01:00
}
} |
|
Show voter details
|
13 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
14 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4200
+user: App\Entity\User {#4183 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: "I have an array based solution but it doesn’t solve the cases of changing the order or empty fields."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1706443234 {#4206
date: 2024-01-28 13:00:34.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4198 …}
+nested: Doctrine\ORM\PersistentCollection {#4196 …}
+votes: Doctrine\ORM\PersistentCollection {#4194 …}
+reports: Doctrine\ORM\PersistentCollection {#4191 …}
+favourites: Doctrine\ORM\PersistentCollection {#4187 …}
+notifications: Doctrine\ORM\PersistentCollection {#4185 …}
-id: 346873
-bodyTs: "'array':4 'base':5 'case':13 'chang':15 'doesn':9 'empti':19 'field':20 'order':17 'solut':6 'solv':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/7100507"
+editedAt: null
+createdAt: DateTimeImmutable @1706443234 {#4204
date: 2024-01-28 13:00:34.0 +01:00
}
} |
|
Show voter details
|
15 |
DENIED
|
edit
|
App\Entity\EntryComment {#4200
+user: App\Entity\User {#4183 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: "I have an array based solution but it doesn’t solve the cases of changing the order or empty fields."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1706443234 {#4206
date: 2024-01-28 13:00:34.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4198 …}
+nested: Doctrine\ORM\PersistentCollection {#4196 …}
+votes: Doctrine\ORM\PersistentCollection {#4194 …}
+reports: Doctrine\ORM\PersistentCollection {#4191 …}
+favourites: Doctrine\ORM\PersistentCollection {#4187 …}
+notifications: Doctrine\ORM\PersistentCollection {#4185 …}
-id: 346873
-bodyTs: "'array':4 'base':5 'case':13 'chang':15 'doesn':9 'empti':19 'field':20 'order':17 'solut':6 'solv':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/7100507"
+editedAt: null
+createdAt: DateTimeImmutable @1706443234 {#4204
date: 2024-01-28 13:00:34.0 +01:00
}
} |
|
Show voter details
|
16 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4200
+user: App\Entity\User {#4183 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: "I have an array based solution but it doesn’t solve the cases of changing the order or empty fields."
+lang: "en"
+isAdult: false
+favouriteCount: 1
+score: 0
+lastActive: DateTime @1706443234 {#4206
date: 2024-01-28 13:00:34.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4198 …}
+nested: Doctrine\ORM\PersistentCollection {#4196 …}
+votes: Doctrine\ORM\PersistentCollection {#4194 …}
+reports: Doctrine\ORM\PersistentCollection {#4191 …}
+favourites: Doctrine\ORM\PersistentCollection {#4187 …}
+notifications: Doctrine\ORM\PersistentCollection {#4185 …}
-id: 346873
-bodyTs: "'array':4 'base':5 'case':13 'chang':15 'doesn':9 'empti':19 'field':20 'order':17 'solut':6 'solv':11"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.world/comment/7100507"
+editedAt: null
+createdAt: DateTimeImmutable @1706443234 {#4204
date: 2024-01-28 13:00:34.0 +01:00
}
} |
|
Show voter details
|
17 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
18 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4281
+user: App\Entity\User {#4294 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: """
> If you fill both fields the output in the terminal is `file|this is some text|`\n
\n
Wouldn’t it be easy to get them using awk by defining `|` as a field separator?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1729128706 {#4276
date: 2024-10-17 03:31:46.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4282 …}
+nested: Doctrine\ORM\PersistentCollection {#4284 …}
+votes: Doctrine\ORM\PersistentCollection {#4286 …}
+reports: Doctrine\ORM\PersistentCollection {#4288 …}
+favourites: Doctrine\ORM\PersistentCollection {#4290 …}
+notifications: Doctrine\ORM\PersistentCollection {#4292 …}
-id: 346800
-bodyTs: "'awk':26 'defin':28 'easi':21 'field':5,31 'file':12 'fill':3 'get':23 'output':7 'separ':32 'termin':10 'text':16 'use':25 'wouldn':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.dbzer0.com/comment/7219040"
+editedAt: null
+createdAt: DateTimeImmutable @1706437319 {#4277
date: 2024-01-28 11:21:59.0 +01:00
}
} |
|
Show voter details
|
19 |
DENIED
|
edit
|
App\Entity\EntryComment {#4281
+user: App\Entity\User {#4294 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: """
> If you fill both fields the output in the terminal is `file|this is some text|`\n
\n
Wouldn’t it be easy to get them using awk by defining `|` as a field separator?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1729128706 {#4276
date: 2024-10-17 03:31:46.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4282 …}
+nested: Doctrine\ORM\PersistentCollection {#4284 …}
+votes: Doctrine\ORM\PersistentCollection {#4286 …}
+reports: Doctrine\ORM\PersistentCollection {#4288 …}
+favourites: Doctrine\ORM\PersistentCollection {#4290 …}
+notifications: Doctrine\ORM\PersistentCollection {#4292 …}
-id: 346800
-bodyTs: "'awk':26 'defin':28 'easi':21 'field':5,31 'file':12 'fill':3 'get':23 'output':7 'separ':32 'termin':10 'text':16 'use':25 'wouldn':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.dbzer0.com/comment/7219040"
+editedAt: null
+createdAt: DateTimeImmutable @1706437319 {#4277
date: 2024-01-28 11:21:59.0 +01:00
}
} |
|
Show voter details
|
20 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4281
+user: App\Entity\User {#4294 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: """
> If you fill both fields the output in the terminal is `file|this is some text|`\n
\n
Wouldn’t it be easy to get them using awk by defining `|` as a field separator?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1729128706 {#4276
date: 2024-10-17 03:31:46.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4282 …}
+nested: Doctrine\ORM\PersistentCollection {#4284 …}
+votes: Doctrine\ORM\PersistentCollection {#4286 …}
+reports: Doctrine\ORM\PersistentCollection {#4288 …}
+favourites: Doctrine\ORM\PersistentCollection {#4290 …}
+notifications: Doctrine\ORM\PersistentCollection {#4292 …}
-id: 346800
-bodyTs: "'awk':26 'defin':28 'easi':21 'field':5,31 'file':12 'fill':3 'get':23 'output':7 'separ':32 'termin':10 'text':16 'use':25 'wouldn':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.dbzer0.com/comment/7219040"
+editedAt: null
+createdAt: DateTimeImmutable @1706437319 {#4277
date: 2024-01-28 11:21:59.0 +01:00
}
} |
|
Show voter details
|
21 |
DENIED
|
ROLE_USER
|
null |
|
Show voter details
|
22 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4365
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: App\Entity\EntryComment {#4281
+user: App\Entity\User {#4294 …}
+entry: App\Entity\Entry {#2412}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: """
> If you fill both fields the output in the terminal is `file|this is some text|`\n
\n
Wouldn’t it be easy to get them using awk by defining `|` as a field separator?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1729128706 {#4276
date: 2024-10-17 03:31:46.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4282 …}
+nested: Doctrine\ORM\PersistentCollection {#4284 …}
+votes: Doctrine\ORM\PersistentCollection {#4286 …}
+reports: Doctrine\ORM\PersistentCollection {#4288 …}
+favourites: Doctrine\ORM\PersistentCollection {#4290 …}
+notifications: Doctrine\ORM\PersistentCollection {#4292 …}
-id: 346800
-bodyTs: "'awk':26 'defin':28 'easi':21 'field':5,31 'file':12 'fill':3 'get':23 'output':7 'separ':32 'termin':10 'text':16 'use':25 'wouldn':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.dbzer0.com/comment/7219040"
+editedAt: null
+createdAt: DateTimeImmutable @1706437319 {#4277
date: 2024-01-28 11:21:59.0 +01:00
}
}
+root: App\Entity\EntryComment {#4281}
+body: """
It is the only solution I found. I described it in the post but put it behind a “spoiler” “What doesn’t work” to make the post shorter.\n
\n
This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1706442463 {#4366
date: 2024-01-28 12:47:43.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@Flyswat@lemmy.dbzer0.com"
]
+children: Doctrine\ORM\PersistentCollection {#4362 …}
+nested: Doctrine\ORM\PersistentCollection {#4358 …}
+votes: Doctrine\ORM\PersistentCollection {#4356 …}
+reports: Doctrine\ORM\PersistentCollection {#4371 …}
+favourites: Doctrine\ORM\PersistentCollection {#4373 …}
+notifications: Doctrine\ORM\PersistentCollection {#4375 …}
-id: 346865
-bodyTs: "'ad':33 'behind':17 'chang':47 'describ':9 'doesn':21 'everi':52 'fail':38 'field':36,44 'found':7 'fragil':59 'input':41 'make':25 'new':35 'order':50 'output':49 'post':13,27 'provid':40 'put':15 'seem':30 'shorter':28 'solut':5 'spoiler':19 'subsequ':53 'unmanag':31 'valu':54 'way':57 'work':23"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://discuss.tchncs.de/comment/6918125"
+editedAt: null
+createdAt: DateTimeImmutable @1706442463 {#4369
date: 2024-01-28 12:47:43.0 +01:00
}
} |
|
Show voter details
|
23 |
DENIED
|
edit
|
App\Entity\EntryComment {#4365
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: App\Entity\EntryComment {#4281
+user: App\Entity\User {#4294 …}
+entry: App\Entity\Entry {#2412}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: """
> If you fill both fields the output in the terminal is `file|this is some text|`\n
\n
Wouldn’t it be easy to get them using awk by defining `|` as a field separator?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1729128706 {#4276
date: 2024-10-17 03:31:46.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4282 …}
+nested: Doctrine\ORM\PersistentCollection {#4284 …}
+votes: Doctrine\ORM\PersistentCollection {#4286 …}
+reports: Doctrine\ORM\PersistentCollection {#4288 …}
+favourites: Doctrine\ORM\PersistentCollection {#4290 …}
+notifications: Doctrine\ORM\PersistentCollection {#4292 …}
-id: 346800
-bodyTs: "'awk':26 'defin':28 'easi':21 'field':5,31 'file':12 'fill':3 'get':23 'output':7 'separ':32 'termin':10 'text':16 'use':25 'wouldn':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.dbzer0.com/comment/7219040"
+editedAt: null
+createdAt: DateTimeImmutable @1706437319 {#4277
date: 2024-01-28 11:21:59.0 +01:00
}
}
+root: App\Entity\EntryComment {#4281}
+body: """
It is the only solution I found. I described it in the post but put it behind a “spoiler” “What doesn’t work” to make the post shorter.\n
\n
This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1706442463 {#4366
date: 2024-01-28 12:47:43.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@Flyswat@lemmy.dbzer0.com"
]
+children: Doctrine\ORM\PersistentCollection {#4362 …}
+nested: Doctrine\ORM\PersistentCollection {#4358 …}
+votes: Doctrine\ORM\PersistentCollection {#4356 …}
+reports: Doctrine\ORM\PersistentCollection {#4371 …}
+favourites: Doctrine\ORM\PersistentCollection {#4373 …}
+notifications: Doctrine\ORM\PersistentCollection {#4375 …}
-id: 346865
-bodyTs: "'ad':33 'behind':17 'chang':47 'describ':9 'doesn':21 'everi':52 'fail':38 'field':36,44 'found':7 'fragil':59 'input':41 'make':25 'new':35 'order':50 'output':49 'post':13,27 'provid':40 'put':15 'seem':30 'shorter':28 'solut':5 'spoiler':19 'subsequ':53 'unmanag':31 'valu':54 'way':57 'work':23"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://discuss.tchncs.de/comment/6918125"
+editedAt: null
+createdAt: DateTimeImmutable @1706442463 {#4369
date: 2024-01-28 12:47:43.0 +01:00
}
} |
|
Show voter details
|
24 |
DENIED
|
moderate
|
App\Entity\EntryComment {#4365
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+entry: App\Entity\Entry {#2412
+user: Proxies\__CG__\App\Entity\User {#1970 …}
+magazine: App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
}
+image: null
+domain: Proxies\__CG__\App\Entity\Domain {#1915 …}
+slug: "Use-YAD-Zenity-dialogues-to-populated-variables-in-a-bash-script"
+title: "Use YAD/Zenity dialogues to populated variables in a bash script?"
+url: null
+body: """
I am learning some bash scripting.\n
\n
I am interested to learn about getting input for my scripts via a GUI interface. It seems that `yad` (forked from `zenity`) is the most robust tool for this. (But if there is a better choice I would like to hear about it too.)\n
\n
Is it possible to obtain *2 or more* named variables using `yad`? *Not* just getting the values based on their positions (`$1`, `$2`, etc), with `awk`. See “What doesn’t work” spoiler for those.\n
\n
What doesn't workI find how to obtain *one* named variable, for [example](https://askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity): `sh inputStr=$(zenity --entry --title=“My Title” --text=“My Text:”) `I also find solutions relying on opening single-variable dialogues sequentially but that’s a terrible interface. Everything else relies on chopping up the output with `awk` or based on the positions, `$1`, `$2`, `$3` etc. In [this script](https://askubuntu.com/a/1251429) `$jpgfile` is obtained: `sh jpgfile=$(echo $OUTPUT | awk ‘BEGIN {FS=“,” } { print $1 }’) `This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.\n
\n
For a simple example, I want to ask the user for a file name and some content. Creating the dialogue is like this:\n
\n
```\n
\n
<span style="color:#323232;">yad --title </span><span style="color:#183691;">"Create a file"</span><span style="color:#323232;"> --form --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"File name"</span><span style="color:#323232;"> --field</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"Content"\n
</span>\n
```\n
\n
If you fill both fields the output in the terminal is `file|this is some text|`. How do I get them into variables like `$filename` and `$filecontent`? So then I can finish the script like this:\n
\n
```\n
\n
<span style="color:#323232;">touch </span><span style="color:#183691;">"$</span><span style="color:#323232;">filename</span><span style="color:#183691;">"\n
</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">filecontent</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">> </span><span style="color:#323232;">$filename\n
</span>\n
```\n
\n
Is this possible??? I do not find it anywhere. I looked though all kinds of websites like [YAD Guide](https://yad-guide.ingk.se/), [yad man page](https://www.mankier.com/1/yad), [smokey01](https://smokey01.com/yad/). Maybe I missed something. On [yaddemo](https://github.com/cjungmann/yaddemo/) I read about bash arrays and it seemed to come close but I couldn’t quite piece it together.
"""
+type: "article"
+lang: "en"
+isOc: false
+hasEmbed: false
+commentCount: 5
+favouriteCount: 9
+score: 0
+isAdult: false
+sticky: false
+lastActive: DateTime @1729147158 {#2410
date: 2024-10-17 08:39:18.0 +02:00
}
+ip: null
+adaAmount: 0
+tags: null
+mentions: null
+comments: Doctrine\ORM\PersistentCollection {#1884 …}
+votes: Doctrine\ORM\PersistentCollection {#1973 …}
+reports: Doctrine\ORM\PersistentCollection {#1959 …}
+favourites: Doctrine\ORM\PersistentCollection {#1927 …}
+notifications: Doctrine\ORM\PersistentCollection {#2442 …}
+badges: Doctrine\ORM\PersistentCollection {#2440 …}
+children: []
-id: 33597
-titleTs: "'bash':9 'dialogu':3 'popul':5 'script':10 'use':1 'variabl':6 'yad/zenity':2"
-bodyTs: "'/),':293 '/1/yad),':299 '/a/1251429)':153 '/cjungmann/yaddemo/)':312 '/questions/489497/store-the-return-string-to-a-variable-from-zenity):':100 '/yad/).':303 '1':72,144,165 '2':56,73,145 '3':146 'ad':170 'also':112 'anywher':280 'array':317 'ask':204 'askubuntu.com':99,152 'askubuntu.com/a/1251429)':151 'askubuntu.com/questions/489497/store-the-return-string-to-a-variable-from-zenity):':98 'awk':76,138,161 'base':68,140 'bash':5,316 'begin':162 'better':41 'chang':184 'choic':42 'chop':133 'close':323 'come':322 'content':213,230 'couldn':326 'creat':214,222 'dialogu':121,216 'doesn':79,86 'echo':159,269 'els':130 'entri':104 'etc':74,147 'everi':189 'everyth':129 'exampl':97,200 'fail':175 'field':173,181,226,229,235 'file':209,224,227,242 'filecont':257,270 'filenam':255,268,271 'fill':233 'find':89,113,278 'finish':262 'fork':26 'form':225 'fragil':196 'fs':163 'get':13,65,250 'github.com':311 'github.com/cjungmann/yaddemo/)':310 'gui':20 'guid':290 'hear':47 'input':14,178 'inputstr':102 'interest':9 'interfac':21,128 'jpgfile':154,158 'kind':285 'learn':3,11 'like':45,218,254,265,288 'look':282 'man':295 'mayb':304 'miss':306 'name':59,94,210,228 'new':172 'obtain':55,92,156 'one':93 'open':117 'order':187 'output':136,160,186,237 'page':296 'piec':329 'posit':71,143 'possibl':53,274 'print':164 'provid':177 'quit':328 'read':314 'reli':115,131 'robust':32 'script':6,17,150,264 'see':77 'seem':23,167,320 'sequenti':122 'sh':101,157 'simpl':199 'singl':119 'single-vari':118 'smokey01':300 'smokey01.com':302 'smokey01.com/yad/).':301 'solut':114 'someth':307 'spoiler':82 'subsequ':190 'termin':240 'terribl':127 'text':108,110,246 'though':283 'titl':105,107,221 'togeth':331 'tool':33 'touch':267 'unmanag':168 'use':61 'user':206 'valu':67,191 'variabl':60,95,120,253 'via':18 'want':202 'way':194 'websit':287 'work':81 'worki':88 'would':44 'www.mankier.com':298 'www.mankier.com/1/yad),':297 'yad':25,62,220,289,294 'yad-guide.ingk.se':292 'yad-guide.ingk.se/),':291 'yaddemo':309 'zeniti':28,103"
+cross: false
+upVotes: 0
+downVotes: 0
+ranking: 1706482025
+visibility: "visible "
+apId: "https://discuss.tchncs.de/post/9987356"
+editedAt: DateTimeImmutable @1729128865 {#1850
date: 2024-10-17 03:34:25.0 +02:00
}
+createdAt: DateTimeImmutable @1706436525 {#2420
date: 2024-01-28 11:08:45.0 +01:00
}
}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: App\Entity\EntryComment {#4281
+user: App\Entity\User {#4294 …}
+entry: App\Entity\Entry {#2412}
+magazine: App\Entity\Magazine {#266}
+image: null
+parent: null
+root: null
+body: """
> If you fill both fields the output in the terminal is `file|this is some text|`\n
\n
Wouldn’t it be easy to get them using awk by defining `|` as a field separator?
"""
+lang: "en"
+isAdult: false
+favouriteCount: 2
+score: 0
+lastActive: DateTime @1729128706 {#4276
date: 2024-10-17 03:31:46.0 +02:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
]
+children: Doctrine\ORM\PersistentCollection {#4282 …}
+nested: Doctrine\ORM\PersistentCollection {#4284 …}
+votes: Doctrine\ORM\PersistentCollection {#4286 …}
+reports: Doctrine\ORM\PersistentCollection {#4288 …}
+favourites: Doctrine\ORM\PersistentCollection {#4290 …}
+notifications: Doctrine\ORM\PersistentCollection {#4292 …}
-id: 346800
-bodyTs: "'awk':26 'defin':28 'easi':21 'field':5,31 'file':12 'fill':3 'get':23 'output':7 'separ':32 'termin':10 'text':16 'use':25 'wouldn':17"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://lemmy.dbzer0.com/comment/7219040"
+editedAt: null
+createdAt: DateTimeImmutable @1706437319 {#4277
date: 2024-01-28 11:21:59.0 +01:00
}
}
+root: App\Entity\EntryComment {#4281}
+body: """
It is the only solution I found. I described it in the post but put it behind a “spoiler” “What doesn’t work” to make the post shorter.\n
\n
This seems unmanageable because adding a new field or failing to provide input for a field will both change the output order of every subsequent value. It’s way too fragile.
"""
+lang: "en"
+isAdult: false
+favouriteCount: 0
+score: 0
+lastActive: DateTime @1706442463 {#4366
date: 2024-01-28 12:47:43.0 +01:00
}
+ip: null
+tags: null
+mentions: [
"@linuxPIPEpower@discuss.tchncs.de"
"@Flyswat@lemmy.dbzer0.com"
]
+children: Doctrine\ORM\PersistentCollection {#4362 …}
+nested: Doctrine\ORM\PersistentCollection {#4358 …}
+votes: Doctrine\ORM\PersistentCollection {#4356 …}
+reports: Doctrine\ORM\PersistentCollection {#4371 …}
+favourites: Doctrine\ORM\PersistentCollection {#4373 …}
+notifications: Doctrine\ORM\PersistentCollection {#4375 …}
-id: 346865
-bodyTs: "'ad':33 'behind':17 'chang':47 'describ':9 'doesn':21 'everi':52 'fail':38 'field':36,44 'found':7 'fragil':59 'input':41 'make':25 'new':35 'order':50 'output':49 'post':13,27 'provid':40 'put':15 'seem':30 'shorter':28 'solut':5 'spoiler':19 'subsequ':53 'unmanag':31 'valu':54 'way':57 'work':23"
+ranking: 0
+commentCount: 0
+upVotes: 0
+downVotes: 0
+visibility: "visible "
+apId: "https://discuss.tchncs.de/comment/6918125"
+editedAt: null
+createdAt: DateTimeImmutable @1706442463 {#4369
date: 2024-01-28 12:47:43.0 +01:00
}
} |
|
Show voter details
|
25 |
DENIED
|
edit
|
App\Entity\Magazine {#266
+icon: Proxies\__CG__\App\Entity\Image {#247 …}
+name: "linux@lemmy.ml"
+title: "linux"
+description: """
From Wikipedia, the free encyclopedia\n
\n
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).\n
\n
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.\n
\n
### Rules\n
\n
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.\n
- No misinformation\n
- No NSFW content\n
- No hate speech, bigotry, etc\n
\n
### Related Communities\n
\n
- [!opensource@lemmy.ml](https://lemmy.ml/c/opensource)\n
- [!libre_culture@lemmy.ml](https://lemmy.ml/c/libre_culture)\n
- [!technology@lemmy.ml](https://lemmy.ml/c/technology)\n
- [!libre_hardware@lemmy.ml](https://lemmy.ml/c/libre_hardware)\n
\n
Community icon by [Alpár-Etele Méder](https://www.iconfinder.com/pocike), licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
"""
+rules: null
+subscriptionsCount: 1
+entryCount: 1406
+entryCommentCount: 28632
+postCount: 6
+postCommentCount: 214
+isAdult: false
+customCss: null
+lastActive: DateTime @1729583542 {#276
date: 2024-10-22 09:52:22.0 +02:00
}
+markedForDeletionAt: null
+tags: null
+moderators: Doctrine\ORM\PersistentCollection {#238 …}
+ownershipRequests: Doctrine\ORM\PersistentCollection {#234 …}
+moderatorRequests: Doctrine\ORM\PersistentCollection {#223 …}
+entries: Doctrine\ORM\PersistentCollection {#181 …}
+posts: Doctrine\ORM\PersistentCollection {#139 …}
+subscriptions: Doctrine\ORM\PersistentCollection {#201 …}
+bans: Doctrine\ORM\PersistentCollection {#118 …}
+reports: Doctrine\ORM\PersistentCollection {#104 …}
+badges: Doctrine\ORM\PersistentCollection {#82 …}
+logs: Doctrine\ORM\PersistentCollection {#72 …}
+awards: Doctrine\ORM\PersistentCollection {#61 …}
+categories: Doctrine\ORM\PersistentCollection {#1820 …}
-id: 73
+apId: "linux@lemmy.ml"
+apProfileId: "https://lemmy.ml/c/linux"
+apPublicUrl: "https://lemmy.ml/c/linux"
+apFollowersUrl: "https://lemmy.ml/c/linux/followers"
+apInboxUrl: "https://lemmy.ml/inbox"
+apDomain: "lemmy.ml"
+apPreferredUsername: "linux"
+apDiscoverable: true
+apManuallyApprovesFollowers: null
+privateKey: null
+publicKey: null
+apFetchedAt: DateTime @1729583596 {#270
date: 2024-10-22 09:53:16.0 +02:00
}
+apDeletedAt: null
+apTimeoutAt: null
+visibility: "visible "
+createdAt: DateTimeImmutable @1698929468 {#272
date: 2023-11-02 13:51:08.0 +01:00
}
} |
|
Show voter details
|