General :: How To Use The Bash Script
Dec 2, 2010
I am looking for a bash script to do the following.
File1:
ID Size
1 8
2 8
[code]....
the script should read the above file and take my input as Size = 8 (may be), count = 3 , sequential = Y and the output should be
7
8
9
and if sequential = N it should give me first 3 ID's with size 8.
1
2
7
note that the ID's are in Hex
View 8 Replies
ADVERTISEMENT
Nov 29, 2010
I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:
Code:
#!/bin/bash
cat > ~/generateGridmix2data.sh << END
[code]...
View 6 Replies
View Related
Jul 17, 2010
below are the details of my system. I have bash as my current shell, some really common commands aren't working.
Do I need to do a re-installation of bash? Or how do I install a selection of bash commands which I need? (for example a subset of [URL])
Code:
root@sdptfw:~ # uname -a
Linux sdptfw.sdpt.co.za 2.4.36 #1 Tue Jul 22 13:13:24 GMT 2008 i686 i686 i386 GNU/Linux
root@sdptfw:~ # echo $SHELL$
/bin/bash$
[Code]....
View 13 Replies
View Related
Dec 3, 2010
What happens when the script executes is that the ssh connection works and parks me at the remote hosts's shell login. Therefore, the "firefox" command refuses to execute. I need to know how to make the "ssh" connection occur, stay open, and go into the background so that the rest of the script can execute.If I could also do this with the "firefox" line so that the entire term window could be closed would also be helpful.
View 3 Replies
View Related
Dec 8, 2009
On one of my servers I see this when I log in. What does this mean and how can I get it to go away? Everything seems to work fine, but none of my other machines give this error.
View 5 Replies
View Related
Feb 4, 2011
I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.
View 3 Replies
View Related
Jan 24, 2010
simple bash code:
Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do
[Code]...
How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!
View 10 Replies
View Related
Jun 5, 2011
I got a problem with terminal, since i'm really a noob with terminal i don't know how to fix it.Everytime i type in a command it shows for example:
-bash: ls: command not found
Even the basic commands don't work... just cd <directory> and those things works
View 9 Replies
View Related
Nov 26, 2008
I have a config file that contains:
my.config:
Code:
Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.
Here is my parse_cmd script:
Code:
View 3 Replies
View Related
Jul 25, 2011
I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.
Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?
View 5 Replies
View Related
Jan 13, 2011
I have searched and searched and maybe I don't know how to articulate this issue with out just posting the problem I'm having. Every time I bring up a terminal window I get the following "Header"
declare -x COLORTERM="gnome-terminal"
declare -x CPLUS_INCLUDE_PATH="/usr/lib64/qt/include"
declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-xSFd6zqrYQ,guid=dc5e07974559da016842742900000090"
declare -x DISPLAY=":0.0"
[Code]...
To be honest I cheated and used the .bashrc / .profile files from Ubuntu and all was working fine for a while now and it seems something changed to cause this... any ideas on why I am getting this? I checked my .bashrc and my /etc/profile and it doesn't look like anything is amiss..
View 3 Replies
View Related
Jan 9, 2010
I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:
Let FILE="thefilenameofsomefilesfor_instance.txt"
Code:
NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`
I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.
View 5 Replies
View Related
Mar 18, 2010
Im used to using nautilus within centos but have recently just got a VPS and quickly realising that using a KDE is unacceptable in this environment. Although I do find it so much quicker doing things like folder permissions in KDE rather than typing it all out in the terminal? Everyone I speak to says, use the terminal and I should learn this way as opposed to using the KDE, but theres certain things I just dont get
How is it possible to make quick changes to scripts and viewing them in a browser etc , without a mouse or using KDE? and only using a terminal?? I am wondering how to develop websites just using the terminal?
How can it be quicker to type out/view permissions etc in the terminal when its instant and just a few clicks in the KDE?
View 3 Replies
View Related
Sep 14, 2011
What is the difference between &> and >& in bash? tldp did not mention the latter one. Is it really a redirection operator?
View 3 Replies
View Related
Jul 15, 2010
I created a system restore file.
code:
And hav tried out:
Code has been streaming past for ages. Longer than a fresh install!
I'm wondering if i've done something to create a cycle?
How and should i interupt it? If i ctl alt F7, will it take me back to Desktop?
View 6 Replies
View Related
May 7, 2011
why rt.sh and test.sh cannot be found, but randm3u.sh runs just fine.
Code:
g ./rt.sh
: No such file or directory
g ./test.sh
: No such file or directory
g ls -l rt.sh test.sh randm3u.sh
[Code]....
View 14 Replies
View Related
Sep 13, 2010
What does symbol ^ do in bash?
For example:
Code:
grep -c ^processor /proc/cpuinfo
View 4 Replies
View Related
Feb 24, 2010
What are significant differences between ksh and bash? I read somewhere that ksh is proprietary shell and bash is completely open source.
View 11 Replies
View Related
Mar 19, 2010
Here is a LIST:
List = "abcd 1234 jvm something"
How to get the second element "1234" without looping all the list?
View 2 Replies
View Related
Jun 19, 2010
If you set or export an environment variable in bash, you can unset it. If you set an alias in bash, you can unalias it. But there doesn't seem to be an unfunction.
Consider this (trivial) bash function, for example, set in a .bash_aliases file and read at shell initialization.
function foo () { echo "bar" ; }
How can I clear this function definition from my current shell? (Changing the initialization files or restarting the shell doesn't count.)
View 1 Replies
View Related
Jun 25, 2010
I'm working on a script to manage some stuff on my server and I'm trying to figure out how I can close my script when I'm done with it. I open it using &, but how can I kill it with another script? I'm trying to do this programmatically but I'm very unfamiliar with Linux.
View 2 Replies
View Related
Jul 23, 2010
I tried to start a tcsh on my Fedora 7 (default shell is bash)
[ss@ssvm ~]$ tcsh
[ss@ssvm ~]$ echo $SHELL
/bin/bash
As you see, another bash shell started.
I looked at the tcsh file:
[ss@ssvm ~]$ ll /bin/tcsh
-rwxr-xr-x 1 root root 345348 2007-02-26 23:58 /bin/tcsh
[ss@ssvm ~]$ ll /bin/csh
lrwxrwxrwx 1 root root 4 2010-03-07 13:13 /bin/csh -> tcsh
It is not a link (but csh is). I don't understand why this is happening.
View 3 Replies
View Related
Jul 30, 2010
I am a bash newbie, and am writing a bash script that will allow transfer of files between two computers. BTW, is there a more secure alternative to scp? Currently, I am doing this manually, by using scp. The remote server always prompts me for the password, and I supply that. I want to automate this (hence the bash script). However, I dont want to supply my password in plain text (or if at all - I was under the impression that open SSL does away with passwords and uses certificates etc?).
how I can automate my current process, without explicitly displaying my password. I am running on Ubuntu 10.0.4
View 1 Replies
View Related
Sep 13, 2010
Is there a difference when variables are referred to as $variableName and ${variableName} in bash?
View 1 Replies
View Related
Nov 17, 2010
I am working on a x86 target running fedora 9.
Whenever I reboot it, my history returns to some state, and I do not have commands I did in the sessions before the reboot.
What I have to change to have updated history I had before reboot?
View 2 Replies
View Related
Dec 15, 2010
I wondered if theres a way to do rotational style completion in bash similar to the behavoir on cmd.exe, I've found it speeds me up in regard to entering commands
View 2 Replies
View Related
Apr 20, 2011
For purposes like compiling GCC from source and being able to do a "profiledbootstrap", I need to be able to use the stage1 compiler (Windows executable) on from Linux. What would be ideal: some setting/command that lets me do gcc.exe from bash and have it work (load WINE automatically). What would be less than ideal but equally fine: tell the GCC build system to call the bootstrap compilers through WINE (ie prepend "wine " to all call to win32 applications).
View 1 Replies
View Related
May 6, 2011
When you are performing time consuming operations in bash like installing new software, is it possible to write text that will appear at the prompt when the operation has finished.
E.g
Imagine running:
apt-get install eclipse-platform
Then it will use quite a while to finish while you see the installation log, meanwhile I want to create new folders (workspaces) which Eclipse later will use.
Is this possible without opening a new terminal (or tab)?
View 5 Replies
View Related
May 26, 2011
how to retrive every portion separately from following file name? DSA4020_frontcover_20346501_2011-05.doc
I want to retrieve informations as below;
name = DSA4020
type = frontcover
id = 20346501
date = 2011-05
is it possible to do with sed??
View 4 Replies
View Related
Jun 8, 2011
I am using Fedora 14 and when I am executing a file:
#!/bin/bash
asd #assuming this command does not exist
I am getting following error:
/path/to/file: line 2: asd: command not found
I want to format it so it outputs error in same way as it would when it was executed from terminal:
$ asd
bash: asd: command not found
View 1 Replies
View Related