Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help needed, linking to file in different sub-folder Post 302554564 by fredfletcher on Monday 12th of September 2011 10:55:58 AM
Old 09-12-2011
Help needed, linking to file in different sub-folder

Hello,

I'd really like some help on this, a PERL-CGI script (complete working script is below).

How can I add the server's root folder (folder_f) to this:

~ s/_e\.shtml/_f\.shtml/

This bit of code searches all occurences of _e.shtml and replaces them with _f.shtml (it being in the same folder).

Yet, in between that, I would like to be able to add the server's root of "folder_f" folder in there, or done another way if it has to.

My script is called "change-language.pl" - which has a hyperlink to it in "file_e.shtml". When clicked, it will try to find the file "file_f.shtml".



For example of what I would like it to do:

~ s/_e\.shtml/(Link-to-FOLDER_F)_f\.shtml/ (found in script below, but I added (FOLDER_F).

I tried: $calling_page =~ s/_e\.shtml/'s/^/$.\f'\/_f\.shtml/;

but it did not work. It brings me to the same _e.shtml file.


I would really appreciate anyone's help on this one, as I can't seem to get it right, with what I know so far.

The complete script is below, which works but only if both language files (file_e.shtml and file_f.shtml) reside in the same folder. I need to be able to have the script work, so that it will find the file (file_f.shtml) but in a different sub-folder on the server's root called "FOLDER_F" folder.

In the part $calling_page =~ s/_e\.shtml/_f\.shtml/; of the script, is there a way to do this:

$calling_page =~ s/_e\.shtml(Link-to_FOLDER_F)/_f\.shtml/; - FOLDER_F being in parentheses is where I would like to be able to have the script modified so that it goes to a sub-folder and get file_f.shtml in FOLDER_F sub-folder.

What I have so far follows WORKS, but only works if both _e.shtml and _f.shtml files are in the same folder:

Code:
#!/usr/bin/perl
#
#
# get the URL for the Web page that called this script
$calling_page = $ENV{'HTTP_REFERER'};


if($calling_page =~ /(.*)\#.*/) {

# # only take the first part up to the #
$calling_page = $1;}

# ignore any file that is not _e.shtml or _f.shtml and do nothing!

# is this an _e.shtml file?

if($calling_page =~ /_e\.shtml/) {
# replace the suffix

$calling_page =~ s/_e\.shtml/_f\.shtml/;

print "Location: $calling_page\n\n";

# then is this an _f.shtml file?

}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

linking unix generated text file to html page

i am trying to link the text files that i generated from my shell script to an html page, to that i can view them using a browser, like internet explorer. i want to open the text files in html page when i enter a command to view the text file from the shell command. please could anyone help... (1 Reply)
Discussion started by: alexd
1 Replies

2. Programming

Linking problem while linking to shared library

Hi I'm getting ld: fatal: option -h and building a dynamic executable are incompatible ld: fatal: Flags processing errors When I run ld -shared -L/usr/dt/lib -lDtSvc -o builtin.so Workspace.o after running gcc -fPIC -I/usr/X11R6/include -I/usr/dt/include -c Workspace.c I'm... (6 Replies)
Discussion started by: laho
6 Replies

3. UNIX for Dummies Questions & Answers

modifying C file and linking back to project files

hi, This is the first time I work in a big C project. All source code files are located in say directory /source/pp and all header files are in /include/pp. I've created a link to both of these directories from my home dir, say /home/ss. So in the /home/ss dir I have the /source/pp and /include/pp... (1 Reply)
Discussion started by: bruins2005
1 Replies

4. Programming

make file - linking

Hi, I have written a makefile and am facing some problem in linking.. This is the first makefile i write.. i think that am just compiling all the .c files and not linking the object files.. can anybody tell me how to link all the .o files??? When i do make all i am getting the following... (1 Reply)
Discussion started by: rvan
1 Replies

5. Shell Programming and Scripting

Parse the .txt file for folder name and FTP to the corrsponding folder.

Oracle procedure create files on UNIX folder on a regular basis. I need to FTP files onto windows server and place the files, based on their name, in the corresponding folders. File name is as follows: ccyymmddfoldernamefile.txt; Folder Name length could be of any size; however, the prefix and... (3 Replies)
Discussion started by: MeganP
3 Replies

6. Programming

dynamic linking of folder name in makefile

i will tell my problem with example: if i have a folder name called sree1.7.3 i know the starting name say sree and also path say /usr/lib. so i want the folder name. and how can i link this folder in makefile thank u sree (1 Reply)
Discussion started by: phani_sree
1 Replies

7. Shell Programming and Scripting

File Management: How do I move all JPGS in a folder structure to a single folder?

This is the file structure: DESKTOP/Root of Photo Folders/Folder1qweqwasdfsd/*jpg DESKTOP/Root of Photo Folders/Folder2asdasdasd/*jpg DESKTOP/Root of Photo Folders/Folder3asdadfhgasdf/*jpg DESKTOP/Root of Photo Folders/Folder4qwetwdfsdfg/*jpg DESKTOP/Root of Photo... (4 Replies)
Discussion started by: guptaxpn
4 Replies

8. Shell Programming and Scripting

want to move set of file from one folder to another folder

Hi all, let me explain my requirments i am having 5 folder with different name for eg) abc , cdf , efd, rtg, ead each 5 folders contain 15 files i want to move 10 files to some other folder, remain 5 files should be there in the same folder. give me some suggestion on this. (6 Replies)
Discussion started by: natraj005
6 Replies

9. Shell Programming and Scripting

Needed script to generate versions for a file and maintian them in a folder

need a shell script for the following requirement how to generate 5 versions of a file in a folder after generating them in a folder i want to maintian the past 2 versions of the file in the folder and i have to delete the the remaining. for example if i ran the script today and tommorow... (3 Replies)
Discussion started by: hemanthsaikumar
3 Replies

10. Shell Programming and Scripting

Help Needed for creating the folder by checking today's date and, take backup using rsync command

How to create a shell script to create a folder by using the today's date to take backup using rsync command on every evening around 7 pm. Kindly help. Thanks. To be more precise, I want to create a script which matches the today's date with server's date format, if matches then creates the... (2 Replies)
Discussion started by: bakula10
2 Replies
SISUSB(4)                                                    Kernel Interfaces Manual                                                    SISUSB(4)

NAME
sisusb - SiS USB video driver SYNOPSIS
Section "Device" Identifier "devname" Driver "sisusb" ... EndSection DESCRIPTION
sisusb is an Xorg driver for SiS (Silicon Integrated Systems) video chips that are connected via a Net2280-based USB dongle. The driver is not accelerated, but provides support for colordepths of 8, 16 and 24 bpp as well as Render and other extensions. SUPPORTED HARDWARE
The sisusb driver supports USB video cards based on the following chipsets: SiS315E/PRO The SiS315E/PRO features two CRT controllers. However, in its USB version, only the first output, referred to as "CRT1", is being used. CONFIGURATION DETAILS
Please refer to xorg.conf(5) for general configuration details and to sis(4) for more information. This manpage only covers a subset of the supported options. Detailed information on all supported options can be obtained at http://www.winischhofer.at/linuxsisusbvga.shtml Please note that this driver requires a Linux kernel driver as well which is included in Linux 2.6.12 and later, as well as available at the aforementioned website. The following driver Options are supported: Option "HWCursor" "boolean" Enable or disable the hardware cursor. It is not recommended to disable the hardware cursor as this will increase the amount of data transferred over the USB. Default: HWCursor is on. Option "SWCursor" "boolean" The opposite of HWCursor. This enables or disables the software cursor. This sort of cursor is slower because the pointer must be painted into the graphics display. This increases the amount of data transferred over the USB significantly. Default: SWCursor is off. Option "CRT1Gamma" "boolean" Enable or disable gamma correction. Default: Gamma correction is on. Option "DisconnectTimeout" "integer" This option determines how the driver will react to a disconnection of the USB device. If the integer supplied is -1, the driver will abort the X server immediately upon disconnection. If the value given is 0, the driver will probe for a re-connection every 2 seconds and in case the device is detected, re-establish the display. If the value is greater than 0, the driver will do this re- probing within the given number of seconds and abort the server if it does not detect the device within this time-out. Default: 0 (probe forever for device reconnection). KNOWN BUGS
none. SEE ALSO
Xorg(1), xorg.conf(5), Xserver(1), X(7), sis(4) http://www.winischhofer.at/linuxsisvga.shtml for more information and updates AUTHORS
Author: Thomas Winischhofer X Version 11 xf86-video-sisusb 0.9.4 SISUSB(4)
All times are GMT -4. The time now is 03:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy