LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-19-2018, 06:15 PM   #1
linuxnoob22
LQ Newbie
 
Registered: Mar 2018
Posts: 5

Rep: Reputation: Disabled
How can you share data in UNIX/Linux?


What feature of the UNIX/Linux shell can you use to simplify the process of sharing data between programs?
 
Old 03-19-2018, 06:30 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
with communication between to different parties their has to a common language established between the two in order for the two to be able to communicate properly and understandably with each other.

the 'shell' as you put it is arbitrary because Unix/ especially Linux has many different shells, bash, sh, dash, KornShell, Z shell, tcsh, to name a few. then you add in two arbitrary programs that you want to communicate between the two using a arbitrary shell. these two arbitrary program have to be set up to use a means to talk to each other via an arbitrary shell.

in other words more precise information is needed in order to even try to attempt to give you a more forward answer.
 
Old 03-19-2018, 06:54 PM   #3
linuxnoob22
LQ Newbie
 
Registered: Mar 2018
Posts: 5

Original Poster
Rep: Reputation: Disabled
Assume that you want two C# or C++ programs to share some data. You can write the first program so that it writes it's output to a file, and then write the second program so that it reads the data from this file. However this process can be difficult and time consuming, especially if you don't know how to program in C# or C++. What feature of the UNIX/Linux shell can you use to simplify the process of sharing data between programs?

is it the join command?
 
Old 03-19-2018, 06:58 PM   #4
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
Blog Entries: 2

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
Systemd

Or: Google...
 
Old 03-19-2018, 06:59 PM   #5
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,235

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
I don't know what you're asking, but here's an overview of how processes can share data:

Wikipedia: Inter-process communication

Shared memory, named pipes, and unix sockets are three off the top of my head.

Hopefully that will help you to ask the question better.

Last edited by dugan; 03-19-2018 at 07:03 PM.
 
2 members found this post helpful.
Old 03-19-2018, 07:09 PM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
it is a program by program basis. awk can pipe to grep, or grep can pipe to awk, cat can pipe to grep then pipe to awk then pipe to sed.

writing a program to do this as apposed to using one that can do this. what are you wanting these two programs to do, what type and format of information output to know how to pipe in into the appropriate program to process it.

Last edited by BW-userx; 03-19-2018 at 07:10 PM.
 
Old 03-19-2018, 07:42 PM   #7
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
I suspect this is another homework question from the OP...so have to start by recommending that s/he Read his textbook and/or use a search engine.

That said, search for “Linux pipe” and “Linux redirect” to see a couple of ways to share data
 
1 members found this post helpful.
Old 03-19-2018, 07:43 PM   #8
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Given the OP's other thread, I can almost guarantee that this is a homework exercise (the opening post was the last sentence in that question, the whole question being posed in the OP's subsequent post). The OP is trying to be hand-fed the answer without really understanding it.
 
Old 03-19-2018, 09:00 PM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,665
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
"Gentle student, what do you think the answer is ... and why?"

When instructors, like me ... (well, in the evenings anyway) pose these questions to you, we are asking you "to think ... for yourself."

So ... "without simply asking someone else for "the right answer," take up the challenge for yourself.

After all – "one day you will find yourself in deep water." (And, by the way, paid to be there.) At that time, all those swimming-books and swimming-tests won't matter at all."

First question: "Do you, in fact, even want to be there?" The choice is entirely yours, and I won't presume to make it for you. But, if so: "prepare yourself."

Last edited by sundialsvcs; 03-19-2018 at 09:02 PM.
 
Old 03-20-2018, 07:23 AM   #10
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
@linuxnoob22,

Please stop posting your test and homework assignment questions, showing no effort. LQ is a friendly site, however not about doing work for you.

All members are volunteers and are willing to help, including with homework assignments. A stated guideline in the LQ Rules is that you do not post homework or test questions verbatim, with one reason being that your instructor may be a LQ member.

The other guidelines are that you need to show some effort with your assignments.

If you wish to solely ask for answers and receive them, then the LQ site is not for you.
 
Old 03-20-2018, 09:02 AM   #11
dave@burn-it.co.uk
Member
 
Registered: Sep 2011
Distribution: Puppy
Posts: 601

Rep: Reputation: 172Reputation: 172
I just got a degree in cutting and pasting???
 
Old 03-20-2018, 12:59 PM   #12
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
the answer to this homework question is: "the pipe".

(sorry, but this question is so elementary and simple, i would feel ashamed not sharing it even if it's homework)

Last edited by ondoho; 03-20-2018 at 01:03 PM.
 
Old 03-20-2018, 02:22 PM   #13
dave@burn-it.co.uk
Member
 
Registered: Sep 2011
Distribution: Puppy
Posts: 601

Rep: Reputation: 172Reputation: 172
And the elementary/simple things are the very ones he needs to be able to look up for himself.
These lessons are not just for programming, they also apply to life in general.
I would never answer my own children's questions directly; I would always tell them where to find the answer. Now they are grown up and thinking of having children of their own, they tell me that they are going to do the same. (but they do get more direct answers now they have learned the lesson).
 
Old 03-21-2018, 01:06 AM   #14
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ you are absolutely right, i should be ashamed of myself.
i just wasted the last hope of turning that poor sod's life around.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Linux Server Revenues Grow, but Unix Still has More Share LXer Syndicated Linux News 0 12-02-2011 04:00 AM
Migration of data file in Unix to linux pandunr Linux - Newbie 3 08-11-2011 12:49 AM
LXer: Encrypt data in Linux/Unix LXer Syndicated Linux News 1 07-01-2009 02:49 AM
LXer: How to share core databases between Unix and Linux LXer Syndicated Linux News 0 04-26-2006 10:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration