I am trying to pull all the information to a log file using:
this is written inside my bash script.
exec >> (tee -a "$log")
but this actually shows all the output and brings all the information to the log file.
can you don't show 1 line of the output inside the bash script?
Related
is it possible to save all the output from a created bash shell file?
Basically the file makes calculations and I would like to save all the output of this created bash shell.
Basically I want to save all the output to a file or sample the last 10 outputs (for example)
$ ./yourscript.sh > outputfile.txt
Where yourscript.sh is the bash shell file you've created and outputfile.txt is the file you want to write the output to.
I trying to append passed text as parameter to file using shell script
this is the code of shell
echo $1>>/etc/freeradius/mods-enabled/ldap
this shell will get the text to add it to the file ldap in /etc/freeradius/mods-enabled path , I call this shell in this format
# sh /etc/append.sh hello how are you man
but in this example the shell only get first word 'hello' and append it to file .how can I tell shell that all words are same variable and should insert to file
It depends on the shell you're using.
In bash the this script should work:
#!/bin/bash
echo "${#:1}">>/etc/freeradius/mods-enabled/ldap
Edit: As DTSCode pointed out in comments the :1 part in the script is redundant so this would be more correct:
#!/bin/bash
echo "$#" >> /etc/freeradius/mods-enabled/ldap
Then give the permissions to execute the file and call
/etc/append.sh hello how are you man
Or without execute permission call
bash /etc/append.sh hello how are you man
I use 2 BASH scripts which convert text to file with .mlf extension.
Definition of output in 1. script:
outfile="${mid}_textgrid.mlf"
i.e: 1_textgrid.mlf
Script is runned by:
bash /var/scripts/textgrid-to-mlf-refference.sh $1
Definition of output in 2. script:
outfile="${mid}_vtt.mlf"
i.e: 1_vtt.mlf
Script is runned by:
bash /var/scripts/vtt-to-mlf-hypothesis.sh $1
mid(multimedia identifier) is defined in another script that creates these files. These files are used to compare using compare.pl script(written in PERL). I can run this script using terminal: i.e: ./compare.pl 1_textgrid.mlf 1_vtt.mlf
Problem is that I want to run this script automatically with BASH script. I tried it in script using: perl /var/scripts/compare.pl $1_textgrid.mlf $1_vtt.mlf But it didn't work. Can you give me an example how to run it correctly in this script?
I made new script in BASG to run this "comparing":
#!/bin/bash
mid=$1
reff="/home/var/www/vids/$mid/${mid}_textgrid.mlf"
hyp="/home/var/www/vids/$mid/${mid}_vtt.mlf"
out="/home/var/www/vids/$mid/${mid}_wer.txt"
perl /var/scripts/mlf_compare.pl $reff $hyp >> $out
I have a bash script which takes in user input and passes it to a tcl script.
The issue is that once I run the script, and the second tcl script is called, upon running the ps -f command, I can see the tcl script instantiation with the arguments passed (all this is in clear text). How can I hide the arguments from appearing in the ps -f output. I was thinking of shuffling and recreating the passed variables, but is there a way of completely hiding them from the ps -f output?
I will be saving the entered Credentials to a file in script 1, then reading the credentials in from the file in script 2 and then deleting the file.
I'm using octave in order to create and execute a script. The script file is created successfully but it is executed correctly ONLY when I execute it from shell.
e.g. if I create the script file containing this line
for L in {1..5}; do > ${L}.txt; done
calling it from shell it creates 5 files
but calling it from octave ( using system("./myscript.sh"); or unix("./myscript.sh"); ) it creates only one file having name "{1..5}.txt"
My actual aim is not to create empty files, the above was just an example. In my script I'm using for loops which fail to be executed from octave.
Try "ps -f" to see which shell Your "myscript.sh" is executed under.
Try adding strict/enforced shell-specifier at the first line to tell it to run under bash.
E.g.
#!/bin/bash
ps -f
for L in {1..5}; do > ${L}.txt; done