English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 11 July 2021, 16:26   #1
TCH
Newbie Amiga programmer
 
TCH's Avatar
 
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
type
and
set
, but how do i connect them together?
Code:
set KECSKE <result of "type kecske.txt" should be here>
I cannot find any info about this. Is this even possible in the AmigaShell? At least with a trick?
TCH is offline  
Old 11 July 2021, 16:42   #2
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Try this:
Code:
set <var> '<command [args]>'
daxb is offline  
Old 11 July 2021, 16:55   #3
TCH
Newbie Amiga programmer
 
TCH's Avatar
 
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...
TCH is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:29.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.06693 seconds with 15 queries