Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 2216 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

the > in UNIX

Thread title: the > in UNIX
Closed Thread    
    Thread tools Search this thread Display Modes  
11-02-2005, 07:14 PM
#1
ktsirig is offline ktsirig
Status: Junior Member
Join date: Oct 2005
Location:
Expertise:
Software:
 
Posts: 46
iTrader: 0 / 0%
 

ktsirig is on a distinguished road

  Old  the > in UNIX

Hi all!
I am confused as to how an old-good UNIX command, like

cat text.txt > new_tex.txt

can be used in PHP.
I tried
system (" cat text.txt > new_text.txt");

but it didn't work, the file new_text.txt was left blank.
Am I doing something wrong with the > ???
Must I use something else instead of 'system' ?

11-02-2005, 07:20 PM
#2
Aros is offline Aros
Aros's Avatar
Status: Lurker
Join date: Jul 2004
Location: the Netherlands
Expertise:
Software:
 
Posts: 1,074
iTrader: 2 / 100%
 

Aros is on a distinguished road

  Old

Try;

PHP Code:
exec("cat text.txt > new_text.txt"); 

11-05-2005, 06:42 AM
#3
ev5 is offline ev5
Status: Junior Member
Join date: Aug 2005
Location:
Expertise:
Software:
 
Posts: 26
iTrader: 0 / 0%
 

ev5 is on a distinguished road

  Old

If you use the backtick operator (or shell_exec()), you can capture the entire output to a string and then hopefully find out what the problem is from there:

PHP Code:
$var = `cat text.txt > new_text.txt`;
echo 
$var

11-18-2005, 07:35 PM
#4
sketchie is offline sketchie
sketchie's Avatar
Status: Senior Member
Join date: Jul 2005
Location:
Expertise:
Software:
 
Posts: 835
iTrader: 1 / 100%
 

sketchie is on a distinguished road

  Old

Originally Posted by ev5
If you use the backtick operator (or shell_exec()), you can capture the entire output to a string and then hopefully find out what the problem is from there:

PHP Code:
$var = `cat text.txt > new_text.txt`;
echo 
$var
I usually use backticks for this sort of thing too.

11-19-2005, 05:37 PM
#5
Selkirk is offline Selkirk
Status: I'm new around here
Join date: Nov 2005
Location:
Expertise:
Software:
 
Posts: 5
iTrader: 0 / 0%
 

Selkirk is on a distinguished road

  Old

Don't forget to use escapeshellarg or escapeshellcmd as appropriate.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed