tagged [shell]

While loop to test if a file exists in bash

While loop to test if a file exists in bash I'm working on a shell script that does certain changes on a txt file only if it does exist, however this test loop doesn't work, I wonder why? Thank you!

4 Mar at 14:9

How to get the list of files in a directory in a shell script?

How to get the list of files in a directory in a shell script? I'm trying to get the contents of a directory using shell script. My script is: ``` for entry in `ls $search_dir`; do echo $entry done ...

13 Mar at 06:18

Read a variable in bash with a default value

Read a variable in bash with a default value I need to read a value from the terminal in a bash script. I would like to be able to provide a default value that the user can change. In this script the ...

15 Apr at 03:41

How can I open a Shell inside a Vim Window?

How can I open a Shell inside a Vim Window? I can open a shell by using the :shell command in Vim, however I can't edit a file and at the same time use the shell. Is there any way to split Vim in many...

6 May at 16:36

How to pass in password to pg_dump?

How to pass in password to pg_dump? I'm trying to create a cronjob to back up my database every night before something catastrophic happens. It looks like this command should meet my needs: Except aft...

24 May at 17:10

How to delete "-" file from svn?

How to delete "-" file from svn? Accidentally I have created file "-" (just a minus) in a directory and commited it. I have to delete it because its causing error on other machines: svn: Can't convert...

28 May at 12:29

Sorting a comma separated list of values

Sorting a comma separated list of values What's the easiest way to sort a comma separated list of values in Mac OS X: Input: "a, b, aaa, bc" Output: "a, aaa, b, bc" I'd like to do this from the termin...

10 Aug at 00:19

How to check if running in Cygwin, Mac or Linux?

How to check if running in Cygwin, Mac or Linux? I have a shell script that is used both on Windows/Cygwin and Mac and Linux. It needs slightly different variables for each versions. How can a shell/b...

12 Aug at 09:10

In a unix shell, how to get yesterday's date into a variable?

In a unix shell, how to get yesterday's date into a variable? I've got a shell script which does the following to store the current day's date in a variable 'dt': How would i go about getting date int...

19 Aug at 02:12

Windows Kiosk App

Windows Kiosk App So, I need to build a kiosk type of application for use in an internet cafe. The app needs to load and display some options of things to do. One option is to launch IE to surf. Anoth...

27 Aug at 03:5

How to do this on the tcsh shell in linux

How to do this on the tcsh shell in linux I want to efficiently do the following on the tcsh in Linux. If I do `somecommand {a,b,c}`, this does `somecommand a b c`, which is not what I want. Is there ...

3 Sep at 18:21

executing shell command in background from script

executing shell command in background from script how can I execute a shell command in the background from within a bash script, if the command is in a string? For example: this does not work -- how c...

10 Sep at 10:36

How to execute a shell script from C in Linux?

How to execute a shell script from C in Linux? How can I execute a shell script from C in Linux?

17 Sep at 14:29

How to get the contents of a webpage in a shell variable?

How to get the contents of a webpage in a shell variable? In Linux how can I fetch an URL and get its contents in a variable in shell script?

19 Sep at 14:2

Use shell utilities for equivalent of SQL group by on a CSV file

Use shell utilities for equivalent of SQL group by on a CSV file I've got a csv file where the left most column contains an ID field. Is there a clever way I can use any utility programs such as sed t...

23 Sep at 23:49

changing permission for files and folder recursively using shell command in mac

changing permission for files and folder recursively using shell command in mac In Linux we can use the following command to change permission mode of the files and folders recursively. > find "/Users...

30 Sep at 20:21

"No such file or directory" but it exists

"No such file or directory" but it exists I simply want to run an executable from the command line, `./arm-mingw32ce-g++`, but then I get the error message, I'm running Ubuntu Linux 10.10. `ls -l` lis...

16 Oct at 14:0

How to send list of file in a folder to a txt file in Linux

How to send list of file in a folder to a txt file in Linux I'm fairly new to Linux (CentOS in this case). I have a folder with about 2000 files in it. I'd like to ideally execute a command at the com...

6 Nov at 06:37

Checking for the correct number of arguments

Checking for the correct number of arguments How do i check for the correct number of arguments (one argument). If somebody tries to invoke the script without passing in the correct number of argument...

3 Dec at 01:12

Problems with a PHP shell script: "Could not open input file"

Problems with a PHP shell script: "Could not open input file" Ok, I am to create an email logger, that uses a PHP shell script. I have set up CPanel to pipe emails to my script. I am sure this is all ...

31 Dec at 02:52

OS X: equivalent of Linux's wget

OS X: equivalent of Linux's wget How can I do an HTTP GET from a Un*x shell script on a stock OS X system? (installing third-party software is not an option, for this has to run on a lot of different ...

31 Dec at 20:19

Shell script to send email

Shell script to send email I am on linux machine and I monitor a process usage. Most of the time I will be away from my system and I have access to internet on my device. So I planned to write a shell...

11 Jan at 13:49

script to search and replace deprecated functions

script to search and replace deprecated functions I am using the following script to search and replace the deprecated functions in a file with the newer ones. ``` 5 for strFile in `ls deprecated_func...

14 Jan at 05:49

bash shell nested for loop

bash shell nested for loop I want to write a nested for loop that has to work in the bash shell prompt. nested for loop in Single line command. For example, In the above example, for loop is executed ...

31 Jan at 05:23

Sending a mail from a linux shell script

Sending a mail from a linux shell script I want to send an email from a Linux Shell script. What is the standard command to do this and do I need to set up any special server names?

1 Mar at 14:36