1753487 Members
4375 Online
108794 Solutions
New Discussion юеВ

Script help

 
Venkat_33
Frequent Advisor

Script help

Hi,

I want output of both like

testin='ls -a'

output with that command how do that
13 REPLIES 13
RAC_1
Honored Contributor

Re: Script help

I am not clear as to what exactly you want.

alias testin='ls -a'

testin would now give what 'ls -a' would give.
There is no substitute to HARDWORK
Venkat_33
Frequent Advisor

Re: Script help

my script will do

testin=`ls -a`

echo $testin >> out.txt

and also i want to include that ls -a command to that file.
RAC_1
Honored Contributor

Re: Script help

type testin >> some_file
Also, you do not need to do echo $testin >> some_file, you need to do as follows.

testin >> some_file
There is no substitute to HARDWORK
Venkat_33
Frequent Advisor

Re: Script help

hi RAC,

its not working
RAC_1
Honored Contributor

Re: Script help

what is not working??
There is no substitute to HARDWORK
Venkat_33
Frequent Advisor

Re: Script help

what is my question is

i want to output the 'ls -a' to some file and also will include what command i executed for this output eg:'la -a'
RAC_1
Honored Contributor

Re: Script help

type testin >> some_file;testin >> some_file
There is no substitute to HARDWORK
James R. Ferguson
Acclaimed Contributor

Re: Script help

Hi Venkat:

Perhaps this is what you want (by example):

# CMD="ls -l /var/tmp";{ echo executing: $CMD;$CMD; } > file

Regards!

...JRF...
Howard Marshall
Regular Advisor

Re: Script help

Just to break it down to its most simple form, If I understand what you want

echo ├в output from ls ├в a command├в > file.out
testin=$(ls ├в a)

echo $testin >> file.out


in this case $( ) works just like the back tick ` `


Howard