Sponsored Content
Full Discussion: bash script problem
Top Forums Shell Programming and Scripting bash script problem Post 47663 by kduffin on Sunday 15th of February 2004 09:51:42 PM
Old 02-15-2004
Tilde expansion seems to have some oddities surrounding it. Not a satisfying answer, because it doesn't solve the real problem, but this seems to work:

Code:
#!/usr/bin/bash

if [ $(grep -c "^\~\/" /tmp/output) -eq 1 ]
then
   VAR=$(cat /tmp/output | sed -e's/\~//g')
   VAR=$(echo $HOME$VAR)
else
   VAR=$(cat /tmp/output)
fi

mkdir $VAR

Cheers,

Keith
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Bash script argument problem

I'm having problems with bash scripts. If a bash script is called with no arguments, I always get "PHIST=!" as the first argument (i.e. this is what $1 equals). Why? Where does this come from, and how can I fix it? Nothing in the bash man pages refer to this mysterious default argument. (2 Replies)
Discussion started by: sszd
2 Replies

2. Shell Programming and Scripting

Problem in bash script

I have written a script and I get error and I don't understand why. neededParameters=2 numOfParameters=0 correctNum=0 while getopts "s:l:" opt do case "$opt" in s) serviceName= $OPTARG #errorline 1 numOfParameters= $numOfParameters + 1 ;; l) ... (12 Replies)
Discussion started by: programAngel
12 Replies

3. Shell Programming and Scripting

Simple bash script problem

#!/bin/bash cd /media/disk-2 Running ./run.sh it's not changing directory.Why? (6 Replies)
Discussion started by: cola
6 Replies

4. Shell Programming and Scripting

problem using variables in bash script

I am using variable to give the location of the file I am using but I get error. Here is the code: LogFile=/tmp/log.email echo -e "could not close the service - error number $error \n" > $LogFile well this is not all the code but is enough because the problem start when I try to use the... (3 Replies)
Discussion started by: programAngel
3 Replies

5. Shell Programming and Scripting

help with a bash script problem

hi to everyone :) i am new to linux and bash and i am trying to build a bash script, that is quite similar to the well known cmd 'split' ... ;) it is now already "working" ... i can use it like: ./splitfix.sh -v -s 10 foo ./splitfix.sh -s 10 -v foo ./splitfix.sh -s 10 foo ./splitfix.sh -v... (5 Replies)
Discussion started by: drjodo
5 Replies

6. Shell Programming and Scripting

Problem using grep in bash script

When it comes to programing and UNIX, I know just enough to be really really dangerous. I have written a python script to parse through a file that contains ~1 million lines. Depending on whether a certain string is matched, the line is copied into a particular file. For the sake of brevity,... (4 Replies)
Discussion started by: errcricket
4 Replies

7. Shell Programming and Scripting

Problem with Bash Script.

Hi guys! I'm new to the forum and to the Bash coding scene. I have the following code paths=/test/a paths=/test/b keywords=\"*car*\" keywords=\"*food*\" for file in `find paths -type f -ctime -1 -name keywords -print 2>/dev/null` do #.... do stuff here for every $file found... (5 Replies)
Discussion started by: RedSpyder
5 Replies

8. Shell Programming and Scripting

Help with bash script problem

Hi, Below is my bash script: cat run_all.sh if && ; then Number_Count_Program $1.results $2.results > $1.$2.counts else Number_Split_Program $1.results $2.results > $1.$2.split fi After I run the following command: ./run_all.sh A B ./run_all.sh: line 1: Anybody advice to edit... (5 Replies)
Discussion started by: perl_beginner
5 Replies

9. Shell Programming and Scripting

Bash/awk script problem

Hi, I have 100 files containing different values in single column, I want to split those files in two separate files (file2 and file3) based on average value of first column of each file, for those files I am working on the following script #bin/bash for memb in $(seq 1 100) do awk... (4 Replies)
Discussion started by: dsp80
4 Replies

10. UNIX for Beginners Questions & Answers

Array problem in Bash Script

I am trying to write a Bash Script using a couple of arrays. I need to perform a countdown of sorts on an array done once daily, but each day would start with the numbers from the previous day. This is what I'm starting with : #!/bin/bash days=(9 8 7 6 5) for (( i = 0 ; i < ${#days} ; i++... (4 Replies)
Discussion started by: cogiz
4 Replies
SYSTEMD-ACTIVATE(8)						 systemd-activate					       SYSTEMD-ACTIVATE(8)

NAME
systemd-activate - Test socket activation of daemons SYNOPSIS
/usr/lib/systemd/systemd-activate [OPTIONS...] daemon [OPTIONS...] DESCRIPTION
systemd-activate can be used to launch a socket activated daemon from the command-line for testing purposes. It can also be used to launch single instances of the daemon per connection (inetd-style). The daemon to launch and its options should be specifed after options intended for systemd-activate. If the -a option is given, file descriptor of the connection will be used as the standard input and output of the launched process. Otherwise, standard input and output will be inherited, and sockets will be passed through file descriptors 3 and higher. Sockets passed through $LISTEN_FDS to systemd-activate will be passed through to the dameon, in the original positions. Other sockets specified with --listen will use consecutive descriptors. OPTIONS
--help, -h Prints a short help text and exits. --version Prints a short version string and exits. -l address, --listen=address Listen on this address. Takes a string like "2000" or "127.0.0.1:2001". -a, --accept Launch a separate instance of daemon per connection and pass the connection socket as standard input and standard output. -E VAR[=VALUE], --environment=VAR[=VALUE] Add this variable to the environment of the launched process. If VAR is followed by "=", assume that it is a variable-value pair. Otherwise, obtain the value from the environment of systemd-activate itself. ENVIRONMENT VARIABLES
$LISTEN_FDS, $LISTEN_PID See sd_listen_fds(3). $SYSTEMD_LOG_TARGET, $SYSTEMD_LOG_LEVEL, $SYSTEMD_LOG_COLOR, $SYSTEMD_LOG_LOCATION Same as in systemd(1). EXAMPLE 1 $ /usr/lib/systemd/systemd-activate -l 2000 -a cat This runs an echo server on port 2000. EXAMPLE 2 $ /usr/lib/systemd/systemd-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd This runs a socket activated instance of systemd-journal-gatewayd(8). SEE ALSO
systemd(1), systemd.socket(5), systemd.service(5), cat(1) systemd 208 SYSTEMD-ACTIVATE(8)
All times are GMT -4. The time now is 10:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy