11 July 2021, 16:26 | #1 |
Newbie Amiga programmer
Join Date: Jun 2012
Location: Front of my A500+
Age: 38
Posts: 372
|
How to put the output of a shell command into a variable
In UNIX you can use shell substitution for this purpose, like
KECSKE=`cat kecske.txt`or KECSKE=$(cat kecske.txt). How is this done in AmigaShell? I know the commands typeand set, but how do i connect them together? Code:
set KECSKE <result of "type kecske.txt" should be here> |
11 July 2021, 16:42 | #2 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,303
|
Try this:
Code:
set <var> '<command [args]>' |
11 July 2021, 16:55 | #3 |
Newbie Amiga programmer
Join Date: Jun 2012
Location: Front of my A500+
Age: 38
Posts: 372
|
So, substitutions are done via the apostrophes. Thank you very much.
Edit: But this is only works at the prompt, not in a shell script. Edit 2: Okay, they were reverse apostrophes, so the backtick works just like in UNIX. Last edited by TCH; 11 July 2021 at 17:04. Reason: Never mind... |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Presenting shell output in nice requester | npagonis73 | support.Other | 8 | 09 May 2021 19:45 |
How to run an Amiga shell from the command line? | palaste | support.Other | 8 | 24 November 2020 01:37 |
Newbie issue: shell command history not working | BigTool4U | New to Emulation or Amiga scene | 17 | 10 June 2020 22:11 |
Sorting output from the list command | Danger Man | New to Emulation or Amiga scene | 10 | 21 April 2019 15:33 |
Shell output to log file | Bloodwych | support.Apps | 3 | 22 December 2009 14:03 |
|
|