LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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: MID-SOUTH USA
Distribution: Slackware 14.2 / Slackware 14.2 current / Manjaro
Posts: 6,440

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
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( I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest; has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,707
Blog Entries: 2

Rep: Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157
Systemd

Or: Google...
 
Old 03-19-2018, 06:59 PM   #5
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 8,288

Rep: Reputation: 3365Reputation: 3365Reputation: 3365Reputation: 3365Reputation: 3365Reputation: 3365Reputation: 3365Reputation: 3365Reputation: 3365Reputation: 3365Reputation: 3365
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: MID-SOUTH USA
Distribution: Slackware 14.2 / Slackware 14.2 current / Manjaro
Posts: 6,440

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
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
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.5
Posts: 1,403

Rep: Reputation: 478Reputation: 478Reputation: 478Reputation: 478Reputation: 478
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 19 MATE
Posts: 5,371
Blog Entries: 2

Rep: Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713
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: 9,078
Blog Entries: 4

Rep: Reputation: 3169Reputation: 3169Reputation: 3169Reputation: 3169Reputation: 3169Reputation: 3169Reputation: 3169Reputation: 3169Reputation: 3169Reputation: 3169Reputation: 3169
"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: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 6,895
Blog Entries: 12

Rep: Reputation: 2479Reputation: 2479Reputation: 2479Reputation: 2479Reputation: 2479Reputation: 2479Reputation: 2479Reputation: 2479Reputation: 2479Reputation: 2479Reputation: 2479
@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: 171Reputation: 171
I just got a degree in cutting and pasting???
 
Old 03-20-2018, 12:59 PM   #12
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 8,943
Blog Entries: 5

Rep: Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178
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: 171Reputation: 171
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: 8,943
Blog Entries: 5

Rep: Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178Reputation: 2178
^ 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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:57 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration