Programming :: Where Are BASH Commands Stored
Feb 21, 2011Where are the other BASH commands/exe stored? If the commands are part of the exe of BASH than ls would not be in a path, correct?
View 11 RepliesWhere are the other BASH commands/exe stored? If the commands are part of the exe of BASH than ls would not be in a path, correct?
View 11 RepliesI am having some weird problems with calling commands stored in a variable (I need to do this to assemble a command with a bunch of parameters automatically and then execute it).Example code that will replicate the weirdness:
$ echo "hello world" > "test file.txt"
$ cat "test file.txt"
hello world
[code]....
I would expect the output to be:
hello world
What happens to the quotes? I have tried various combinations of single quotes, escaped quotes, etc, but it seems like quotes in a variable are not evaluated as quotes when that variable is executed.
want to set more text files. They have "tab" differently (3, 4, 6 or 5 characters space).I have to use "sed" or "awk" sette them in the same tab (for example five space haracters).
View 14 Replies View Relatedim pretty sure this is a remedial task for many of you but im having an issue with arrays from a shell script being accessed in an awk command. im pretty good with shell scripting but i am embarrassingly unfamiliar with awk. so here's the meat of the script...
Code:
I am trying to take an input file of ip addresses and corresponding netmasks and put it into a format to be loaded onto a juniper switch. the result should look something like this.. x.x.x.x/netmask using the cidr notation. no matter what subnet is provided though, /32 always gets appended to the end of the ip even when it should be /16, /24, etc... also, the cisco part works fine so that doesnt need any attention.
I have a command which on the command line needs to look like this
rlam -if3 '!pvalue -H image1.jpg' > image2.jpg
Nevermind what rlam or pvalue do ... they are part of a program package I am using. The above command works on the command line, and also when written verbatim in a bash shell script.
My problem is: in the script I wish to replace image1.jpg with the content of a variable, e.g.
IM1=image1.jpg
How to I get the script to insert the value of $IM into the command when the pvalue part of it needs to be quoted?
need to modify some scripts to repeat the commands in them until a variable returns a proper value. I need it to add some redundancy to some scripts i use to upload files to a remote server.This is an example of a portion of those scripts:
Code:
################## site UPLOAD ##################
site_login=$(curl -c $site_cookie -L -F user=$site_user -F pass=$site_password -F
[code]....
I am running a simple script that I copied from slug.ceca.utc.edu/docs/2009-3-26-linux-server-health.pdf and edited with the names and paths of my own servers. I don't know much about scripting (re: nothing) but I wanted to try and be efficient in my new role as a Linux Sys Admin. The script was saved to root's home directory and runs as part of root's crontab once a week. The script runs with no problem, but it doesn't actually seem to run all of the commands contained within. It skips some in the middle and the end and I don't know why. The script itself is this:
Code:
#!/in/bash
uname -a > /tmp/server.txt
[code]...
I have read where C is first converted to Assembly before its final compilation to binary. Is there a way to do this with Bash commands? I would like the understanding that Assembly allows to Bash somehow.
View 14 Replies View Relatedbelow 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]....
I have a bash profile (with custom terminal color settings) and also a gnome panel (with quick-launchers on it and other customizations). Assuming these things are stored in text files, where in my ~home directory can I find them? I ask because I want to duplicate them on a another linux box to have the same bash profile/taskbar, and If I can do it by copying files instead of manually recreating them, it would be better.
View 2 Replies View Related(variable substitution?)
(parameter expansion?)
Code:
run_repeatedly()
{
NUM=0
while [ <irrelevant stuff here> ]
[Code]....
run_repeatedly "programX -o "./messy/path/output-$NUM.txt"" The echo inside the loop prints "...-$NUM.txt"; obviously I'm aiming to have bash substitute the iteration number so that I end up with many output files not 1.
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 RelatedI have machine that I used to VNC to on my network with Remote Desktop Viewer from my Fedora 12. When I first connected I checked the checkbox that I wanted to store the pw. Now the pw on the other machine has changed but Remote Desktop Viewer does not ask for a new password, it just gives me a black screen, like I am connected but I can't see anything. I'd like to know if anyone knows where this pw data is stored on the system so I can start fresh. I already tried uninstalling Remote Desktop Viewer and installing it again.
View 1 Replies View RelatedI need to call a function that takes a string array as argument, declared like this:Code:int someFunction(/* some parameters... */, const char* s[]);I'd like to know how to allocate memory for the string array. I know a string is an array of chars and an array is a pointer to the first element, then a string array should simply be a two dimensional char array. But is it a single memory block where all strings are stored consecutively?? Or is it a base vector where each element is a pointer to a separate memory block that contains a single string?More specifically: should I malloc() a single memory block large enough for all the strings? or should I allocate separate blocks for each string plus an extra one for the base vector?
View 5 Replies View RelatedI'm setting up a scheduler to run some bash script commands but they won't run when I point them to a script file. If I change the cron to call
[code]...
If I run ./writeTimeToLog from the terminal - it, well, writes the time to the log file! I then use
[code]...
to test I can schedule this to run every minute just so I can see it working. the entry was a basic as I could make. It adds the cron successfully but never seems to update the file. Where would an error be put if one occurred.
I would like to be able to connect to a machine, list a directory, wait long enough for me to see the results then move on to the next machine.This is failing:
Code:
#!/bin/bash
while read line; do
[code]...
I would be running SQL commands (UPDATE/SELECT) from within my bash script. I am completely new to this subject. Is MYSQL used for this purpose? Alternatively, what is sqlplus?
View 6 Replies View RelatedOur CentOS 5 server had a weird issue last Friday. We couldn't run any bash commands, such as ls, vi. It said that it could not find /bin/ls. The only commands we can run are internal commands, such as ps, cd. After we reboot the server, everything is back.
I don't know what's wrong with it. Does anyone give me a explanation?
I'm studying the C Language, None of the documents I'm reading covers returning values from a function. They state that the function sends the valve to the caller but that is the only info I have. Do I have to create a varible with the name of the function I called and is it stored there?
View 14 Replies View Relatedwhere the printk messages are stored when we call a insmod? I'm using Slackware, and I think my distro can store these messages on others place.
View 3 Replies View RelatedI need to launch a bash file in Linux from an unprivileged user session, file that will run bash commands as root. But I do not want to create an user with root privileges to do that.
View 10 Replies View RelatedThis is a really odd bug I can't seem to figure it out. Basically, commands like ls can see all the files in the current directory, however when I go to execute the file it will give errors like "file not found", even when it most obviously is. If you look at my command history in the screenshot, you can see I can ls into a directory and see it's contents. When I try to run the file, I get the "no such file or directory" error.
However, if I type simply 'vm', I can't use tab completion to complete the directory name, and my third command is me typing 'vm' and hitting tabtab, it lists a bunch of vmware specific tools instead of the subdirectory name. I can then ls and see my current directory contents, and it will list only the single subdirectory. However, then I tried to use the full filepath from root to run the file, still to no avail. If anyone has any insight,
is there any way I can pass commands to the CLI of a tool directly?
I would like to script some actions, for example:
./OpenBTS < "tmsis"
I do not need to retrieve the results (I watch it in the log file). how I could realize that? There is now way to do this using command line parameters, at least not that I found out. So it looks like I have to figure out sth myself. Maybe I could automate screen in a way to detect the prompt and "paste" my command there. Are there tools for this on Linux?
Is there any way to list just the folders in a directory using bash commands? ( as the ls command lists all the files and folders )
View 3 Replies View RelatedWhat is the difference between For and While when creating loops in bash scripting?
View 1 Replies View RelatedI made a script that contains repetitious commands (snmpget and awk are the only ones at the moment. Running these commands from standard terminal work, but when run within a script, I get:
./reg_sm_count: line 10: snmpget: command not found
./reg_sm_count: line 10: awk: command not found
./reg_sm_count: line 10: snmpget: command not found
[code]...
I'm creating a bash script that contains the following line:"ssh user@$server1 cd /tmp; pwd"What I want is to print /tmp of server1, but the script it isn't printing that
View 2 Replies View RelatedI'm trying create script to manage one mysql database, including new db and user creation. But I'm not able get it working when I put SQL commands into function. So I create simple script for testing which is still not working
Code:
#!/bin/bash -x
MAIN_DIR="/admin/mysql"
MYSQL_CNF="$MAIN_DIR/auth.cnf"
MYSQL_CMD="mysql --defaults-file=$MYSQL_CNF"
[code]....
I'd like to add custom startup commands (for example starting a process, registering to a registration server, downloading a configuration file) to the Linux startup process. Those commands should be triggered on startup only. What is the standard/appropriate way to do this?
EDIT: Is /etc/profile the right place to trigger such things?
EDIT2: I'm using Ubuntu.
I created variables in python and would like to be able to incorporate those into bash commands that will be mixed into the script. Example:
Code:
name=raw_input("Type your name and press ENTER: ")
import os
os.system( echo "name")
Of course this doesn't actually work, but i think you get an indication of what I am trying to do.