Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Is echo $variable >> text.txt working in MacOSX? Post 302375325 by jackt on Friday 27th of November 2009 08:27:29 AM
Old 11-27-2009
I'm sorry, of course should I get you all every info I have..

Backstory: In the FTP-Server (Rumpus) you can use 'Event Notice' that triggers when someone downloads or uploads some files.

And one thing is to use Shell Commands like this (this put the file in a folder that is named after an variable and put some variables in an xml-file in the same folder);

Code:
mkdir /<HOMEPATH ANONYMOUS>/<FORMVAR kund>
echo '<?xml version="1.0" encoding="ISO-8859-1"?>' >> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml
echo '<data>' >> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml
echo '\t<kund><FORMVAR kund></kund>' >> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml
echo '\t<kundmail><FORMVAR kundmail></kundmail>' >> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml
echo '\t<projektledare><FORMVAR projektledare></projektledare>' >> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml
echo '\t<filename_arg><FILENAME></filename_arg>' >> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml
echo '\t<sidor><FORMVAR sidor></sidor>' >> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml
echo '\t<date_arg><DATE></date_arg>' >> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml
echo '</data>' >> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml
cp <FILE> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>
rm <FILE>

This works perfect, but is somehow a bit difficult to overlook and the application don't like this amount of code (to many characters). And I get some input from a friend to use the "$example" to get some better code;

Code:
mkdir /<HOMEPATH ANONYMOUS>/<FORMVAR kund>
outputfile = '/<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml'
echo '<?xml version="1.0" encoding="ISO-8859-1"?>' >> $outputfile
echo '<data>' >> $outputfile
echo '\t<kund><FORMVAR kund></kund>' >> $outputfile
echo '\t<kundmail><FORMVAR kundmail></kundmail>' >> $outputfile
echo '\t<projektledare><FORMVAR projektledare></projektledare>' >> $outputfile
echo '\t<filename_arg><FILENAME></filename_arg>' >> $outputfile
echo '\t<papperkv><FORMVAR papperkv></papperkv>' >> $outputfile
echo '\t<sidor><FORMVAR sidor></sidor>' >> $outputfile
echo '\t<format><FORMVAR format></format>' >> $outputfile
echo '\t<date_arg><DATE></date_arg>' >> $outputfile
echo '\t<time_arg><TIME></time_arg>' >> $outputfile
echo '\t<note><FORMVAR note></note>' >> $outputfile
echo '</data>' >> $outputfile
cp <FILE> /<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>
rm <FILE>

But this don't work, and it is possible like that Neo is saying that "outputfile = '/<HOMEPATH ANONYMOUS>/<FORMVAR kund>/<FILENAME>.xml'" don't work inside applications (in MacOS X).

So my question this time is:
Is there some other way to solve this? It feels like the app just use direct commands (like the first example).

Thanks Neo for the info, and sorry that I missed all extra info..

Best Regards..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

echo "ABC" > file1.txt file2.txt file3.txt

Hi Guru's, I need to create 3 files with the contents "ABC" using single command. Iam using: echo "ABC" > file1.txt file2.txt file3.txt the above command is not working. pls help me... With Regards / Ganapati (4 Replies)
Discussion started by: ganapati
4 Replies

2. Shell Programming and Scripting

echo 2 txt files to screen no carraige return

I have two text files, each of then only containing ONE line and NO carraige return or white space at the end...how do I echo both of these text files to the screen without putting an extra line? I want to do this from the command line. file1.txt: this is file1.txt 1 file2.txt: this is... (4 Replies)
Discussion started by: ajp7701
4 Replies

3. Shell Programming and Scripting

Echo working funny

Hello, this is my first post and question. I have search before for this problem but didn't find anything similar. My case: I have a string inside the variable string1 like this: string1="lala lele lili lolo lulu" When I do echo of it, it appears like this: echo $string1 lala lele lili... (8 Replies)
Discussion started by: hemtar
8 Replies

4. Shell Programming and Scripting

echo is not working as expected

for i in `cat /export/home/afahmed/Arrvial_time.txt` do echo $i echo $i | awk '$3 < $D { print $4 }' >> dynamic_DF.txt; done When i echo, its echo as Nov 15 02:24 /export/home/pp_adm/inbound//wwallet_20111115.txt where i expect it to be Nov 15 02:24... (7 Replies)
Discussion started by: afahmed
7 Replies

5. Shell Programming and Scripting

How to echo $variable into txt file?

Hello i tried many times echo $variables into text file with no success for example: echo "#!/bin/sh BBHTAG=RFOCLT_check # What we put in bb-hosts to trigger this test COLUMN=RFOCLT # Name of the column, often same as tag in bb-hosts $BBHOME/bin/bbhostgrep $BBHTAG | while read... (5 Replies)
Discussion started by: mogabr
5 Replies

6. Shell Programming and Scripting

Echo variable contents into a text file...

Hi all, I am trying to create a script to read my Windows UUIDs and create mounts in fstab. I know there are different and maybe even better ways to mount Windows partitions at boot time, but I always manually create them in fstab successfully. I do a clean install of Ubuntu often and would like to... (2 Replies)
Discussion started by: Ian Pride
2 Replies

7. Windows & DOS: Issues & Discussions

2 Questions: replace text in txt file, add text to end of txt file

so... Lets assume I have a text file. The text file contains multiple "#" symbols. I want to replace all thos "#"s with a STRING using DOS/Batch I want to add a certain TEXT to the end of each line. How can I do this WITHOUT aid of sed, grep or anything linux related ? (1 Reply)
Discussion started by: pasc
1 Replies

8. Shell Programming and Scripting

Echo not working with $

$cat FILE.txt $PATH1/file1.txt $PATH2/file2.txt where$PATH 1 = /root/FILE_DR/file1.txt $PATH 2 = /root/FILE_DR/file2.txt for I in `cat FILE.txt` do v=`echo $I` echo $v if then rm $v (5 Replies)
Discussion started by: ekharvi
5 Replies

9. Shell Programming and Scripting

Echo command not working in the script

HI I have and echo command which works perfectly in the shell but when i execute in the script it gives me an error code query is as below QUERY=`echo "Select Severity,Dupl_count,Creation_Time,Last_Received,Node_Name,Node_Name,Object,Message_Group,Message_Text,Last_Annotation from " \ ... (2 Replies)
Discussion started by: Jcpratap
2 Replies

10. Shell Programming and Scripting

Search last column of INPUT.txt in TABLEs text and add correspond columns to INPUT.txt

Hi dears i use bash shell i have INPUT.txt like this number of columns different in one some row have 12 , some 11 columns see last column INPUT.txt CodeGender Age Grade Dialect Session Sentence Start End Length Phonemic Phonetic 63 M 27 BS/BA TEHRANI 3 4 298320 310050... (2 Replies)
Discussion started by: alii
2 Replies
echo(3XCURSES)						  X/Open Curses Library Functions					    echo(3XCURSES)

NAME
echo, noecho - enable/disable terminal echo SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib -R /usr/xpg4/lib -lcurses [ library... ] c89 [ flag... ] file... -lcurses [ library... ] #include <curses.h> int echo(void); int noecho(void); DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially, curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft- ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined. RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5) SunOS 5.11 5 Jun 2002 echo(3XCURSES)
All times are GMT -4. The time now is 09:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy