How to use gettext in bash script?
I only found this page, but I don't understand it.
Localization
My script is written like this:
#!/bin/bash
. lang_file.sh
echo $LANG_HELLO_WORLD
And lang_file.sh look like that:
#!/bin/bash
LANG_HELLO_WORLD="Hello World"
I want to change lang_file.sh to something using gettext, like this:...
I've a XML file with the contents:
<?xml version="1.0" encoding="utf-8"?>
<job xmlns="http://www.sample.com/">programming</job>
I need a way to extract what is in the <job..> </job> tags, programmin in this case. This should be done on linux command prompt, using grep/sed/awk.
...
Hello,
I sometimes do this in my shell :
sam@sam-laptop:~/shell$ ps aux | grep firefox | awk '{print $2}'
2681
2685
2689
4645
$ kill -9 2681 2685 2689 4645
Is there a way I can transform the multiple lines containing the PIDs into one line separated by spaces ?
(It's a little bit annoying to type the PIDs every time and I really wou...
Hello there,
I'm trying to extract the year from this output :
sam@sam-laptop:~/shell$ date
Mon Feb 8 21:57:00 CET 2010
sam@sam-laptop:~/shell$ date | cut -d' ' -f7
2010
sam@sam-laptop:~/shell$ date | awk '{print $6}'
2010
Are there any other ways to get the same result ? using maybe grep, sed etc ?
Merci !
...
I have two commands, foo and foo-bar, where foo is a symlink to foo-bar. I want to be able to type f+TAB (pretend these are the only two commands on the path that begin with f) and have one of them be completed (meaning the full name and the space after).
What ends up happening though is that it completes to just foo (no space) because ...
I'm trying to pipe data into "cut" to, say, cut away the first column of text. This works
$ cat test.txt | cut -d\ -f2-
Reading from stdin also works:
$ cut -d\ -f2- -
? doc/html/analysis.html
? doc/html/classxytree-members.html
<CTRL+D>
However, as soon as a pipe is involved, it doesn't accept my <CTRL+D> anymore, and I can't si...
Is there a way to find out the MIME-TYPE (or is it called "Content-Type"...) of a file in a linux bash script?
The reason I need it is because imageshack appears to need it to upload a file as for some reason it detects the .png file as an "application/octet-stream"…
I'v checked the file, and it really is a .png
$ cat /1.png
?PNG
(wi...
Here is how i run dos2unix recursively on all files:
find -exec dos2unix {} \;
What do i need to change to make it skip over files under .svn/ directories?
...
$SSH_CLIENT has IP address with some port info, and echo $SSH_CLIENT gives me '10.0.40.177 52335 22', and Running
if [ -n "$SSH_CONNECTION" ] ;
then
for i in $SSH_CLIENT
do
echo $i
done
fi
gives me
10.0.40.177
52335
22
And I see the first element is the IP address.
Q : How can I get the first element of $SSH_CLIENT...
I have little computer, MMnet1000 with BusyBox, and compiling anything on it is nightmare.
I want to do something simple like "0,5*2", but can't without additional software.
I tried "expr", "let", and just can't do any operation with float numbers.
Is there something I can do?
UPDATE --- Carl Norum
root@MMnet:/kafka# dc
-ash: dc: no...
I need to compare a variable to some string (and do something if they match).
How can i do the comparison?
...
I run 'net use /user:"Someone" \somewhere', and it works well with cmd.exe.
With the same cmd.exe, run 'bash --login -i' to use the cygwin/bash, and run the same command but I get the error message as follows.
System error 67 has occurred.
The network name cannot be found.
Q: Why can't I run 'net use /user' command with cygwin/bash...
How can I paste to codepad.org from the commandline using curl?
...
I just wrote this backup script:
#!/usr/bin/bash
# the number of days to do the backup for.
days=5;
# the files to backup.
location[0]='/opt/aDirectory/'
location[1]='/extra/anotherDirectory/'
# the location to copy the file to
copyLocation='/users/JoeBlow/Backup/backup-'$(date | tr ' ' '-')
# Log stuff
mkdir $copyLocation
echo "mad...
On CYGWIN, I want a BASH script to:
create an SSH tunnel to a remote server.
Do some work locally that uses the tunnel.
Then shutdown the tunnel.
The "shutdown part" has me perplexed.
Currently, I have a lame solution. In one shell I run the following to create a tunnel.
# Create the tunnel - this works! It runs forever, until sh...
Hi All,
I'm having some trouble figuring this out.
I have a script that checks a log file that is generated the day after the date specified by the script call. This is because the files fetched for the specified day's data won't be fetched until the day after. And when that cron runs in the morning, the log file will have a timestamp...
Hi,
Is there a shell command to know about how much memory is being used at a particular moment and details of how much each process is using, how much virtual memory is left etc?
...
Hello,
I have a bash script that checks for and deploys new .ear files to the JBoss server.I have linked this script to a web page, so that users can deploy their applications by clicking on the link.
I have also been able to set a status message that the application is being deployed, when a user clicks on the link.(Done using Javascri...
!/bin/bash
echo Enter the num
read n
for i in { 1..10 }
do
m=$(( n*i ))
echo "$i * $n" = $m
done
i got error as
for: 8: Illegal number: {
kindly suggest a solution
...
Hi,
I have the following question:
When I execute the following script directly in a terminal window, the commands behave as expected.
$ diff <(echo tmp) <(echo tmp1)
1c1
< tmp
---
> tmp1
However when I write the same command in a shell script
#! /bin/bash
diff <(echo tmp) <(echo tmp1)
I get the following error message:
$ sh tes...