LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-13-2017, 01:22 PM   #16
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 102

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled

Okay !

Let me put it in this way:

Assume I am running the Makefile from the "/home" folder:
Code:
.c.o: 
        $(CC) -c -dg $< -o $@ \     -------> here I am compiling my /home/user/file1.c file with -dg option which generates file1.c.100.dg
        2>&1
        -$(MV) -f *.dg $(DEBUG_PATH)/ 2>/dev/null
So, the /home/user/file1.c executes and generates the ".o" file at /home/user/file1.o. But, the file1.c.100.dg file generates at "/home/" as /home/file1.c.100.dg along with some other files also

The above process continues for all the files file1.c,file2.c,...etc.

Now, I want to secure these *.c.100.dg files in a separate folder.
 
Old 05-13-2017, 02:35 PM   #17
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Please check again the location of these files: you shouldn't be able to create files in /home/ only in /home/rpittala/
 
Old 05-14-2017, 02:30 AM   #18
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 102

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Yeah !

That was just an example to understand the paths. Kindly, assume different locations.

Last edited by rpittala; 05-14-2017 at 02:33 AM.
 
Old 05-14-2017, 03:59 AM   #19
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
in post #1 you told
Quote:
it generates "*.c.100.dg" file at the current working directory
in post #16 you explained
Quote:
But, the file1.c.100.dg file generates at "/home/" as /home/file1.c.100.dg along with some other files also
would be nice to know exactly what's happening...
 
Old 05-14-2017, 06:12 AM   #20
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
> Kindly, assume different locations.

It doesn't work this way; you describe the actual situation, please.

Last edited by NevemTeve; 05-14-2017 at 09:01 AM.
 
Old 05-18-2017, 07:37 PM   #21
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,791

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
Try a shell loop
Code:
for x in *.c.100.dg; do \
if [ -e "$x" ]; then \
$(MV) -f "$x" $(DEBUG_PATH) 2>/dev/null; \
fi \;
done
Maybe you'll need to escape $x as $$x
 
1 members found this post helpful.
  


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
[SOLVED] how to list files in directory or generate links for files in a directory darksaurian Programming 7 08-08-2015 01:28 PM
[SOLVED] Command for Generate Files name in a Directory to TXT file. hack3rcon Linux - Newbie 5 02-01-2015 08:36 AM
how to generate file and directory access logs? dushyantgohil Linux - Server 5 10-29-2012 04:50 AM
Easiest way to transfer files through an intermediate computer farnsy Linux - Networking 4 08-01-2012 05:15 PM
OpenSSL: generate Intermediate CA? new_to_open_ssl Linux - Security 15 01-24-2006 07:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:52 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
Open Source Consulting | Domain Registration